From e3a70c1f04e8fc8df5fb7ba64509bc08ae25f12c Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 21 May 1999 19:27:44 +0000 Subject: -Added regex cache -Made module thread-safe --- ext/pcre/php_pcre.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'ext/pcre/php_pcre.h') diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index a5b5671111..551f35b5a4 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -37,6 +37,8 @@ #include "pcre.h" extern void php_info_pcre(ZEND_MODULE_INFO_FUNC_ARGS); +extern int php_minit_pcre(INIT_FUNC_ARGS); +extern int php_mshutdown_pcre(SHUTDOWN_FUNC_ARGS); extern int php_rinit_pcre(INIT_FUNC_ARGS); PHP_FUNCTION(pcre_match); @@ -45,6 +47,32 @@ PHP_FUNCTION(pcre_replace); extern zend_module_entry pcre_module_entry; #define pcre_module_ptr &pcre_module_entry +typedef struct { + pcre *re; + pcre_extra *extra; +} pcre_cache_entry; + +typedef struct { + HashTable pcre_cache; +} php_pcre_globals; + +#ifdef ZTS +# define PCRE_LS_D php_pcre_globals *pcre_globals +# define PCRE_LS_DC , PCRE_LS_D +# define PCRE_LS_C pcre_globals +# define PCRE_LS_CC , PCRE_LS_C +# define PCRE_G(v) (pcre_globals->v) +# define PCRE_LS_FETCH() php_pcre_globals *pcre_globals = ts_resource(pcre_globals_id); +#else +# define PCRE_LS_D +# define PCRE_LS_DC +# define PCRE_LS_C +# define PCRE_LS_CC +# define PCRE_G(v) (pcre_globals.v) +# define PCRE_LS_FETCH() +extern ZEND_API php_pcre_globals pcre_globals; +#endif + #else #define pcre_module_ptr NULL -- cgit v1.2.1