andrei Wed Sep 25 10:02:35 2002 EDT
Modified files:
/php4/ext/standard reg.c reg.h
Log:
Fix bug #17570.
Index: php4/ext/standard/reg.c
diff -u php4/ext/standard/reg.c:1.65 php4/ext/standard/reg.c:1.66
--- php4/ext/standard/reg.c:1.65 Tue Sep 24 12:34:54 2002
+++ php4/ext/standard/reg.c Wed Sep 25 10:02:34 2002
@@ -17,7 +17,7 @@
| Jaakko Hyv�tti <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.65 2002/09/24 16:34:54 iliaa Exp $ */
+/* $Id: reg.c,v 1.66 2002/09/25 14:02:34 andrei Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -26,11 +26,7 @@
#include "reg.h"
#include "ext/standard/info.h"
-#ifdef ZTS
-int reg_globals_id;
-#else
-static php_reg_globals reg_globals;
-#endif
+ZEND_DECLARE_MODULE_GLOBALS(reg)
typedef struct {
regex_t preg;
@@ -75,25 +71,28 @@
#undef regcomp
#define regcomp(a, b, c) _php_regcomp(a, b, c)
-static void php_reg_init_globals(php_reg_globals *reg_globals TSRMLS_DC)
+static void php_reg_init_globals(zend_reg_globals *reg_globals TSRMLS_DC)
{
zend_hash_init(®_globals->ht_rc, 0, NULL, (void (*)(void *))
_free_reg_cache, 1);
}
-PHP_MINIT_FUNCTION(regex)
+static void php_reg_destroy_globals(zend_reg_globals *reg_globals TSRMLS_DC)
{
-#ifdef ZTS
- ts_allocate_id(®_globals_id, sizeof(php_reg_globals), (ts_allocate_ctor)
php_reg_init_globals, NULL);
-#else
- php_reg_init_globals(®_globals TSRMLS_CC);
-#endif
+ zend_hash_destroy(®_globals->ht_rc);
+}
+PHP_MINIT_FUNCTION(regex)
+{
+ ZEND_INIT_MODULE_GLOBALS(reg, php_reg_init_globals, php_reg_destroy_globals);
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(regex)
{
- zend_hash_destroy(®(ht_rc));
+#ifndef ZTS
+ php_reg_destroy_globals(®_globals TSRMLS_CC);
+#endif
+
return SUCCESS;
}
Index: php4/ext/standard/reg.h
diff -u php4/ext/standard/reg.h:1.15 php4/ext/standard/reg.h:1.16
--- php4/ext/standard/reg.h:1.15 Thu Feb 28 03:26:49 2002
+++ php4/ext/standard/reg.h Wed Sep 25 10:02:34 2002
@@ -17,7 +17,7 @@
*/
-/* $Id: reg.h,v 1.15 2002/02/28 08:26:49 sebastian Exp $ */
+/* $Id: reg.h,v 1.16 2002/09/25 14:02:34 andrei Exp $ */
#ifndef REG_H
#define REG_H
@@ -32,9 +32,9 @@
PHP_FUNCTION(spliti);
PHPAPI PHP_FUNCTION(sql_regcase);
-typedef struct {
+ZEND_BEGIN_MODULE_GLOBALS(reg)
HashTable ht_rc;
-} php_reg_globals;
+ZEND_END_MODULE_GLOBALS(reg)
PHP_MINIT_FUNCTION(regex);
PHP_MSHUTDOWN_FUNCTION(regex);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php