diff --git a/php_weakref.c b/php_weakref.c index 1b105eb..8739d3e 100644 --- a/php_weakref.c +++ b/php_weakref.c @@ -29,6 +29,12 @@ #include "wr_weakmap.h" #include "php_weakref.h" +#ifdef ZTS +int weakref_globals_id; +#else +zend_weakref_globals weakref_globals; +#endif + void wr_store_init(TSRMLS_D) /* {{{ */ { wr_store *store = emalloc(sizeof(wr_store)); diff --git a/php_weakref.h b/php_weakref.h index 2685b50..0d62733 100644 --- a/php_weakref.h +++ b/php_weakref.h @@ -75,10 +75,10 @@ void wr_store_attach(zend_object *intern, wr_ref_dtor dtor, zval *ref TSRMLS_DC) #ifdef ZTS #define WR_G(v) TSRMG(weakref_globals_id, zend_weakref_globals *, v) -int weakref_globals_id; +extern int weakref_globals_id; #else #define WR_G(v) (weakref_globals.v) -zend_weakref_globals weakref_globals; +extern zend_weakref_globals weakref_globals; #endif #endif /* PHP_WEAKREF_H */ diff --git a/wr_weakmap.c b/wr_weakmap.c index 7ed1cdb..24b4c27 100644 --- a/wr_weakmap.c +++ b/wr_weakmap.c @@ -31,6 +31,9 @@ #include "wr_weakmap.h" #include "php_weakref.h" +zend_object_handlers wr_handler_WeakMap; +WEAKREF_API zend_class_entry *wr_ce_WeakMap; + static void wr_weakmap_ref_dtor(void *ref_object, zend_object_handle ref_handle, zend_object *wref_obj TSRMLS_DC) { /* {{{ */ wr_weakmap_object *intern = (wr_weakmap_object *)wref_obj; diff --git a/wr_weakmap.h b/wr_weakmap.h index 9ed93cd..afc41f5 100644 --- a/wr_weakmap.h +++ b/wr_weakmap.h @@ -36,9 +36,6 @@ typedef struct _wr_weakmap_object { extern WEAKREF_API zend_class_entry *wr_ce_WeakMap; -zend_object_handlers wr_handler_WeakMap; -WEAKREF_API zend_class_entry *wr_ce_WeakMap; - #endif /* WR_WEAKMAP_H */ /* diff --git a/wr_weakref.c b/wr_weakref.c index 4cb2e31..d2328b5 100644 --- a/wr_weakref.c +++ b/wr_weakref.c @@ -29,6 +29,9 @@ #include "wr_weakref.h" #include "php_weakref.h" +zend_object_handlers wr_handler_WeakRef; +WEAKREF_API zend_class_entry *wr_ce_WeakRef; + static void wr_weakref_ref_dtor(void *ref_object, zend_object_handle ref_handle, zend_object *wref_obj TSRMLS_DC) { /* {{{ */ wr_weakref_object *wref = (wr_weakref_object *)wref_obj; diff --git a/wr_weakref.h b/wr_weakref.h index 057eafd..b801918 100644 --- a/wr_weakref.h +++ b/wr_weakref.h @@ -32,9 +32,6 @@ typedef struct _wr_weakref_object { extern WEAKREF_API zend_class_entry *wr_ce_WeakRef; -zend_object_handlers wr_handler_WeakRef; -WEAKREF_API zend_class_entry *wr_ce_WeakRef; - #endif /* WR_WEAKREF_H */ /*