@@ -180,18 +180,9 @@ static int pcre_clean_cache(void *data, void *arg TSRMLS_DC)
180
180
}
181
181
/* }}} */
182
182
183
- /* {{{ pcre_get_compiled_regex
184
- */
185
- PHPAPI pcre * pcre_get_compiled_regex (char * regex , pcre_extra * * extra , int * preg_options TSRMLS_DC )
186
- {
187
- int compile_options ;
188
- return pcre_get_compiled_regex_ex (regex , extra , preg_options , & compile_options TSRMLS_CC );
189
- }
190
- /* }}} */
191
-
192
- /* {{{ pcre_get_compiled_regex_ex
183
+ /* {{{ pcre_get_compiled_regex_cache
193
184
*/
194
- PHPAPI pcre * pcre_get_compiled_regex_ex (char * regex , pcre_extra * * extra , int * preg_options , int * compile_options TSRMLS_DC )
185
+ PHPAPI pcre_cache_entry * pcre_get_compiled_regex_cache (char * regex , int regex_len , pcre_extra * * extra , int * preg_options , int * compile_options TSRMLS_DC )
195
186
{
196
187
pcre * re = NULL ;
197
188
int coptions = 0 ;
@@ -203,7 +194,6 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr
203
194
char end_delimiter ;
204
195
char * p , * pp ;
205
196
char * pattern ;
206
- int regex_len ;
207
197
int do_study = 0 ;
208
198
int poptions = 0 ;
209
199
unsigned const char * tables = NULL ;
@@ -230,7 +220,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr
230
220
* extra = pce -> extra ;
231
221
* preg_options = pce -> preg_options ;
232
222
* compile_options = pce -> compile_options ;
233
- return pce -> re ;
223
+ return pce ;
234
224
#if HAVE_SETLOCALE
235
225
}
236
226
}
@@ -393,9 +383,30 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr
393
383
new_entry .tables = tables ;
394
384
#endif
395
385
zend_hash_update (& PCRE_G (pcre_cache ), regex , regex_len + 1 , (void * )& new_entry ,
396
- sizeof (pcre_cache_entry ), NULL );
386
+ sizeof (pcre_cache_entry ), ( void * * ) & pce );
397
387
398
- return re ;
388
+ return pce ;
389
+ }
390
+ /* }}} */
391
+
392
+ /* {{{ pcre_get_compiled_regex
393
+ */
394
+ PHPAPI pcre * pcre_get_compiled_regex (char * regex , pcre_extra * * extra , int * preg_options TSRMLS_DC )
395
+ {
396
+ int compile_options ;
397
+ pcre_cache_entry * pce = pcre_get_compiled_regex_cache (regex , strlen (regex ), extra , preg_options , & compile_options TSRMLS_CC );
398
+
399
+ return pce ? pce -> re : NULL ;
400
+ }
401
+ /* }}} */
402
+
403
+ /* {{{ pcre_get_compiled_regex_ex
404
+ */
405
+ PHPAPI pcre * pcre_get_compiled_regex_ex (char * regex , pcre_extra * * extra , int * preg_options , int * compile_options TSRMLS_DC )
406
+ {
407
+ pcre_cache_entry * pce = pcre_get_compiled_regex_cache (regex , strlen (regex ), extra , preg_options , compile_options TSRMLS_CC );
408
+
409
+ return pce ? pce -> re : NULL ;
399
410
}
400
411
/* }}} */
401
412
0 commit comments