change array_list API
authorMichael Wallner <mike@php.net>
Wed, 12 Dec 2012 11:41:59 +0000 (11:41 +0000)
committerMichael Wallner <mike@php.net>
Wed, 12 Dec 2012 11:41:59 +0000 (11:41 +0000)
php_http_curl_client.c
php_http_misc.c
php_http_misc.h

index 83640a30ef0cca30a1a880f0289d9a29ac56b4d7..640f3bbf5cdf5365aebb45d913eabcfc1116dbe3 100644 (file)
@@ -526,7 +526,7 @@ static STATUS php_http_curl_client_option_set_range(php_http_option_t *opt, zval
 
                FOREACH_VAL(pos, val, rr) {
                        if (Z_TYPE_PP(rr) == IS_ARRAY) {
-                               if (2 == php_http_array_list(*rr TSRMLS_CC, 2, &rb, &re)) {
+                               if (2 == php_http_array_list(Z_ARRVAL_PP(rr) TSRMLS_CC, 2, &rb, &re)) {
                                        if (    ((Z_TYPE_PP(rb) == IS_LONG) || ((Z_TYPE_PP(rb) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(rb), Z_STRLEN_PP(rb), NULL, NULL, 1))) &&
                                                        ((Z_TYPE_PP(re) == IS_LONG) || ((Z_TYPE_PP(re) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(re), Z_STRLEN_PP(re), NULL, NULL, 1)))) {
                                                zval *rbl = php_http_ztyp(IS_LONG, *rb);
@@ -614,7 +614,7 @@ static STATUS php_http_curl_client_option_set_portrange(php_http_option_t *opt,
        if (val && Z_TYPE_P(val) != IS_NULL) {
                zval **z_port_start, *zps_copy = NULL, **z_port_end, *zpe_copy = NULL;
 
-               switch (php_http_array_list(val TSRMLS_CC, 2, &z_port_start, &z_port_end)) {
+               switch (php_http_array_list(Z_ARRVAL_P(val) TSRMLS_CC, 2, &z_port_start, &z_port_end)) {
                case 2:
                        zps_copy = php_http_ztyp(IS_LONG, *z_port_start);
                        zpe_copy = php_http_ztyp(IS_LONG, *z_port_end);
index 4115042312b1f328f1032b1a1bfec218880dc40c..f14354abfab28291799129062f97f8a46553d108 100644 (file)
@@ -142,16 +142,15 @@ int php_http_select_str(const char *cmp, int argc, ...)
 
 /* ARRAYS */
 
-PHP_HTTP_API unsigned php_http_array_list(zval *hash TSRMLS_DC, unsigned argc, ...)
+PHP_HTTP_API unsigned php_http_array_list(HashTable *ht TSRMLS_DC, unsigned argc, ...)
 {
-       HashTable *ht = HASH_OF(hash);
        HashPosition pos;
        unsigned argl = 0;
        va_list argv;
 
        va_start(argv, argc);
        for (   zend_hash_internal_pointer_reset_ex(ht, &pos);
-                       zend_hash_has_more_elements_ex(ht, &pos) && (argl < argc);
+                       SUCCESS == zend_hash_has_more_elements_ex(ht, &pos) && (argl < argc);
                        zend_hash_move_forward_ex(ht, &pos))
        {
                zval **data, ***argp = (zval ***) va_arg(argv, zval ***);
@@ -230,12 +229,6 @@ int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list
 
 /* PASS CALLBACK */
 
-PHP_HTTP_API size_t php_http_pass_wrapper(php_http_pass_callback_arg_t *cb, const char *str, size_t len)
-{
-       TSRMLS_FETCH();
-       return cb->cb_zts(cb->cb_arg, str, len TSRMLS_CC);
-}
-
 PHP_HTTP_API size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len)
 {
        php_http_pass_fcall_arg_t *fcd = cb_arg;
index 2ee38e1f07e2e4eb18ea529eef9f95737f7aae6b..67fc711e2c96113bf72ed87a9e03dc10f5e62c1c 100644 (file)
@@ -326,6 +326,7 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c
                INIT_NS_CLASS_ENTRY(ce, #ns, #classname, php_ ##name## _method_entry); \
                php_ ##name## _class_entry = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
                php_ ##name## _class_entry->ce_flags |= flags;  \
+               php_http_register_class(php_ ##name## _get_class_entry); \
        }
 
 #define PHP_HTTP_REGISTER_INTERFACE(ns, ifacename, name, flags) \
@@ -335,6 +336,7 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c
                INIT_NS_CLASS_ENTRY(ce, #ns, #ifacename, php_ ##name## _method_entry); \
                php_ ##name## _class_entry = zend_register_internal_interface(&ce TSRMLS_CC); \
                php_ ##name## _class_entry->ce_flags |= flags; \
+               php_http_register_class(php_ ##name## _get_class_entry); \
        }
 
 #define PHP_HTTP_REGISTER_EXCEPTION(classname, cename, parent) \
@@ -401,8 +403,7 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c
 #endif /* PHP_HTTP_HAVE_CURL */
 
 /* ARRAYS */
-
-PHP_HTTP_API unsigned php_http_array_list(zval *hash TSRMLS_DC, unsigned argc, ...);
+PHP_HTTP_API unsigned php_http_array_list(HashTable *ht TSRMLS_DC, unsigned argc, ...);
 
 typedef struct php_http_array_hashkey {
        char *str;
@@ -427,6 +428,9 @@ static inline void php_http_array_hashkey_stringfree(php_http_array_hashkey_t *k
        }
 }
 
+typedef void (*php_http_array_visitor_t)(void *visitor_arg, php_http_array_hashkey_t *key, zval **val TSRMLS_DC);
+PHP_HTTP_API void php_http_array_visit(HashTable *ht, php_http_array_visitor_t visitor_func, void *visitor_arg TSRMLS_DC);
+
 #define FOREACH_VAL(pos, array, val) FOREACH_HASH_VAL(pos, HASH_OF(array), val)
 #define FOREACH_HASH_VAL(pos, hash, val) \
        for (   zend_hash_internal_pointer_reset_ex(hash, &pos); \