merge=touch for package meta files
[m6w6/ext-raphf] / php_raphf.c
index fa3f61c101f8520ebc4a5ff75ef555d4834a5926..1de0fc0c2bc780bad5b1f9815b9f021cc1f6d1c2 100644 (file)
@@ -37,7 +37,14 @@ ZEND_END_MODULE_GLOBALS(raphf)
 
 ZEND_DECLARE_MODULE_GLOBALS(raphf)
 
-typedef int STATUS;
+#if PHP_VERSION_ID < 50500
+#undef SUCCESS
+#undef FAILURE
+typedef enum {
+       SUCCESS = 0,
+       FAILURE = -1
+} ZEND_RESULT_CODE;
+#endif
 
 #ifndef PHP_RAPHF_DEBUG_PHANDLES
 #      define PHP_RAPHF_DEBUG_PHANDLES 0
@@ -118,6 +125,20 @@ void php_resource_factory_handle_dtor(php_resource_factory_t *f,
        }
 }
 
+php_resource_factory_t *php_persistent_handle_resource_factory_init(
+               php_resource_factory_t *a, php_persistent_handle_factory_t *pf)
+{
+       return php_resource_factory_init(a,
+                       php_persistent_handle_get_resource_factory_ops(), pf,
+                       (void(*)(void*)) php_persistent_handle_abandon);
+}
+
+zend_bool php_resource_factory_is_persistent(php_resource_factory_t *a)
+{
+       return a->dtor == (void(*)(void *)) php_persistent_handle_abandon;
+}
+
+
 static inline php_persistent_handle_list_t *php_persistent_handle_list_init(
                php_persistent_handle_list_t *list)
 {
@@ -240,7 +261,7 @@ static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
                size_t ident_len TSRMLS_DC)
 {
        php_persistent_handle_list_t **list, *new_list;
-       STATUS rv = zend_symtable_find(&provider->list.free, ident_str,
+       ZEND_RESULT_CODE rv = zend_symtable_find(&provider->list.free, ident_str,
                        ident_len + 1, (void *) &list);
 
        if (SUCCESS == rv) {
@@ -301,11 +322,11 @@ static void php_persistent_handle_hash_dtor(void *p)
        php_resource_factory_dtor(&provider->rf);
 }
 
-PHP_RAPHF_API STATUS php_persistent_handle_provide(const char *name_str,
+PHP_RAPHF_API ZEND_RESULT_CODE php_persistent_handle_provide(const char *name_str,
                size_t name_len, php_resource_factory_ops_t *fops, void *data,
                void (*dtor)(void *) TSRMLS_DC)
 {
-       STATUS status = FAILURE;
+       ZEND_RESULT_CODE status = FAILURE;
        php_persistent_handle_provider_t provider;
 
        if (php_persistent_handle_list_init(&provider.list)) {
@@ -332,7 +353,7 @@ php_persistent_handle_factory_t *php_persistent_handle_concede(
                php_persistent_handle_wakeup_t wakeup,
                php_persistent_handle_retire_t retire TSRMLS_DC)
 {
-       STATUS status = FAILURE;
+       ZEND_RESULT_CODE status = FAILURE;
        php_persistent_handle_factory_t *free_a = NULL;
 
        if (!a) {
@@ -388,7 +409,7 @@ void *php_persistent_handle_acquire(
                php_persistent_handle_factory_t *a, void *init_arg  TSRMLS_DC)
 {
        int key;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
        ulong index;
        void **handle_ptr, *handle = NULL;
        php_persistent_handle_list_t *list;
@@ -473,7 +494,7 @@ void php_persistent_handle_cleanup(const char *name_str, size_t name_len,
 {
        php_persistent_handle_provider_t *provider;
        php_persistent_handle_list_t *list;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        if (name_str && name_len) {
                rv = zend_symtable_find(&PHP_RAPHF_G->persistent_handle.hash, name_str,