diff options
author | Xuefer <xuefer@gmail.com> | 2014-11-10 11:07:01 +0000 |
---|---|---|
committer | Xuefer <xuefer@gmail.com> | 2014-11-10 11:07:01 +0000 |
commit | 51accff949c03c54a1f5fef4c54e2aa61feb00ba (patch) | |
tree | f1047f9923d4511b6ea4adbdaae7333ad73f919f /xcache | |
parent | 6c397c70ecd8a7a4e67dd347614ee4571c2830fd (diff) | |
download | xcache-51accff949c03c54a1f5fef4c54e2aa61feb00ba.tar.gz xcache-51accff949c03c54a1f5fef4c54e2aa61feb00ba.zip |
fix build for older PHP
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1561 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'xcache')
-rw-r--r-- | xcache/xc_compatibility.c | 25 | ||||
-rw-r--r-- | xcache/xc_compatibility.h | 11 | ||||
-rw-r--r-- | xcache/xc_utils.c | 6 |
3 files changed, 41 insertions, 1 deletions
diff --git a/xcache/xc_compatibility.c b/xcache/xc_compatibility.c index 07ad6f5..2b2f8bb 100644 --- a/xcache/xc_compatibility.c +++ b/xcache/xc_compatibility.c @@ -43,3 +43,28 @@ long xc_atol(const char *str, int str_len) /* {{{ */ } /* }}} */ #endif + +#if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_2) +void *xc_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC) /* {{{ */ +{ + zval zobject; + Z_OBJ_HANDLE_P(&zobject) = handle; + return zend_object_store_get_object(&zobject TSRMLS_CC); +} +/* }}} */ +void xc_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC) /* {{{ */ +{ + zval zobject; + Z_OBJ_HANDLE_P(&zobject) = handle; + zend_objects_store_add_ref(&zobject TSRMLS_CC); +} +/* }}} */ +void xc_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) /* {{{ */ +{ + zval zobject; + Z_OBJ_HANDLE_P(&zobject) = handle; + zobject.refcount = 0; + zend_objects_store_del_ref(&zobject TSRMLS_CC); +} +/* }}} */ +#endif diff --git a/xcache/xc_compatibility.h b/xcache/xc_compatibility.h index 8840a30..b2be78c 100644 --- a/xcache/xc_compatibility.h +++ b/xcache/xc_compatibility.h @@ -282,4 +282,15 @@ long xc_atol(const char *str, int len); # endif #endif +#if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_2) +void *xc_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC); +# define zend_object_store_get_object_by_handle xc_object_store_get_object_by_handle + +void xc_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC); +# define zend_objects_store_add_ref_by_handle xc_objects_store_add_ref_by_handle + +void xc_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC); +# define zend_objects_store_del_ref_by_handle xc_objects_store_del_ref_by_handle +#endif + #endif /* XC_COMPATIBILITY_H_54F26ED90198353558718191D5EE244C */ diff --git a/xcache/xc_utils.c b/xcache/xc_utils.c index b757b3c..244d015 100644 --- a/xcache/xc_utils.c +++ b/xcache/xc_utils.c @@ -641,10 +641,14 @@ void xc_copy_internal_zend_constants(HashTable *target, HashTable *source) /* {{ zend_class_entry *xc_lookup_class(const char *class_name, int class_name_len, zend_bool autoload TSRMLS_DC) /* {{{ */ { xc_cest_t *cest; -#ifdef ZEND_ENGINE_2 +#ifdef ZEND_ENGINE_2_4 if (zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &cest TSRMLS_CC) != SUCCESS) { return NULL; } +#elif defined(ZEND_ENGINE_2) + if (zend_lookup_class_ex(class_name, class_name_len, autoload, &cest TSRMLS_CC) != SUCCESS) { + return NULL; + } #else if (zend_hash_find(EG(class_table), class_name, class_name_len, (void **) &cest) != SUCCESS) { return NULL; |