From c7ba512e091cf698cd07c1088749bb7476102504 Mon Sep 17 00:00:00 2001 From: liaozaixue Date: Fri, 26 Feb 2016 18:13:22 +0800 Subject: [PATCH] add zend_hash_index_find_wrapper --- src/php7_ext_wrapper.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/php7_ext_wrapper.h b/src/php7_ext_wrapper.h index 0ea820a..f7061a6 100644 --- a/src/php7_ext_wrapper.h +++ b/src/php7_ext_wrapper.h @@ -87,6 +87,18 @@ static inline int zend_hash_find_wrapper(HashTable *ht, char *key, int key_len, } } +static inline int zend_hash_index_find_wrapper(HashTable *ht, int index, zval **value) +{ + zval **pp = NULL; + if (zend_hash_index_find(ht, index, (void**)&pp) == SUCCESS) { + *value = *pp; + return SUCCESS; + } else { + *value = NULL; + return FAILURE; + } +} + static inline int zend_get_configuration_directive_wrapper(char *name, int len, zval **value) { @@ -154,7 +166,12 @@ static inline int zend_hash_find_wrapper(HashTable *ht, char *key, int key_len, *value = zend_hash_find(ht, Z_STR(zkey)); return (*value != NULL ? SUCCESS : FAILURE); } - +static inline int zend_hash_index_find_wrapper(HashTable *ht, int index, + zval **value) +{ + *value = zend_hash_index_find(ht, index); + return (*value != NULL ? SUCCESS : FAILURE); +} static inline int zend_hash_update_wrapper(HashTable *ht, char *k, int len, void *val, int size, void *ptr) {