diff options
-rw-r--r-- | ext/dom/php_dom.c | 17 | ||||
-rw-r--r-- | ext/dom/xpath.c | 6 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_plugin.c | 4 | ||||
-rw-r--r-- | ext/pdo/pdo_sql_parser.c | 32 | ||||
-rw-r--r-- | ext/pdo/pdo_sql_parser.re | 7 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 99 | ||||
-rw-r--r-- | ext/sockets/conversions.c | 13 | ||||
-rw-r--r-- | ext/standard/info.c | 29 | ||||
-rw-r--r-- | main/output.c | 8 | ||||
-rw-r--r-- | main/php_ini.c | 9 | ||||
-rw-r--r-- | main/streams/streams.c | 25 | ||||
-rw-r--r-- | sapi/apache2handler/apache_config.c | 21 | ||||
-rw-r--r-- | win32/registry.c | 12 |
13 files changed, 84 insertions, 198 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index b6b66fc507..04c7e3a40e 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -418,7 +418,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ * HashTable *debug_info, *prop_handlers = obj->prop_handler, *std_props; - HashPosition pos; + zend_string *string_key; dom_prop_handler *entry; zval object_value; @@ -435,19 +435,10 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ * ZVAL_STRING(&object_value, "(object value omitted)"); - for (zend_hash_internal_pointer_reset_ex(prop_handlers, &pos); - (entry = zend_hash_get_current_data_ptr_ex(prop_handlers, &pos)) != NULL; - zend_hash_move_forward_ex(prop_handlers, &pos)) { + ZEND_HASH_FOREACH_STR_KEY_PTR(prop_handlers, string_key, entry) { zval value; - zend_string *string_key; - zend_ulong num_key; - if (entry->read_func(obj, &value) == FAILURE) { - continue; - } - - if (zend_hash_get_current_key_ex(prop_handlers, &string_key, - &num_key, &pos) != HASH_KEY_IS_STRING) { + if (entry->read_func(obj, &value) == FAILURE || !string_key) { continue; } @@ -457,7 +448,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ * } zend_hash_add(debug_info, string_key, &value); - } + } ZEND_HASH_FOREACH_END(); zval_dtor(&object_value); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index e7a3ed7648..1fb6574695 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -520,14 +520,12 @@ PHP_FUNCTION(dom_xpath_register_php_functions) if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "a", &array_value) == SUCCESS) { intern = Z_XPATHOBJ_P(id); - zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); - while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(array_value)))) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) { zend_string *str = zval_get_string(entry); ZVAL_LONG(&new_string,1); zend_hash_update(intern->registered_phpfunctions, str, &new_string); - zend_hash_move_forward(Z_ARRVAL_P(array_value)); zend_string_release(str); - } + } ZEND_HASH_FOREACH_END(); intern->registerPhpFunctions = 2; RETURN_TRUE; diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c index 243dae41d7..d0709282f1 100644 --- a/ext/mysqlnd/mysqlnd_plugin.c +++ b/ext/mysqlnd/mysqlnd_plugin.c @@ -168,10 +168,6 @@ PHPAPI void * _mysqlnd_plugin_find(const char * const name) /* {{{ _mysqlnd_plugin_apply_with_argument */ PHPAPI void _mysqlnd_plugin_apply_with_argument(apply_func_arg_t apply_func, void * argument) { - /* Note: We want to be thread-safe (read-only), so we can use neither - * zend_hash_apply_with_argument nor zend_hash_internal_pointer_reset and - * friends - */ zval *val; int result; diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index d29e3b13b7..11e245d7d1 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.7.5 */ +/* Generated by re2c 0.13.5 */ #line 1 "ext/pdo/pdo_sql_parser.re" /* +----------------------------------------------------------------------+ @@ -70,10 +70,9 @@ static int scan(Scanner *s) } yy2: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy4; - } else { - goto yy10; + switch (yyaccept) { + case 0: goto yy4; + case 1: goto yy10; } yy3: yyaccept = 0; @@ -82,7 +81,7 @@ yy3: yy4: #line 63 "ext/pdo/pdo_sql_parser.re" { SKIP_ONE(PDO_PARSER_TEXT); } -#line 86 "ext/pdo/pdo_sql_parser.c" +#line 85 "ext/pdo/pdo_sql_parser.c" yy5: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -166,7 +165,7 @@ yy7: yy8: #line 62 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_BIND_POS); } -#line 170 "ext/pdo/pdo_sql_parser.c" +#line 169 "ext/pdo/pdo_sql_parser.c" yy9: ++YYCURSOR; switch ((yych = *YYCURSOR)) { @@ -176,7 +175,7 @@ yy9: yy10: #line 65 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 180 "ext/pdo/pdo_sql_parser.c" +#line 179 "ext/pdo/pdo_sql_parser.c" yy11: yych = *++YYCURSOR; switch (yych) { @@ -213,7 +212,7 @@ yy14: yy16: #line 64 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 217 "ext/pdo/pdo_sql_parser.c" +#line 216 "ext/pdo/pdo_sql_parser.c" yy17: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -293,7 +292,7 @@ yy29: yy31: #line 60 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 297 "ext/pdo/pdo_sql_parser.c" +#line 296 "ext/pdo/pdo_sql_parser.c" yy32: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -367,7 +366,7 @@ yy32: yy34: #line 61 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_BIND); } -#line 371 "ext/pdo/pdo_sql_parser.c" +#line 370 "ext/pdo/pdo_sql_parser.c" yy35: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -397,7 +396,7 @@ yy40: ++YYCURSOR; #line 59 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 401 "ext/pdo/pdo_sql_parser.c" +#line 400 "ext/pdo/pdo_sql_parser.c" yy42: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -419,7 +418,7 @@ yy45: ++YYCURSOR; #line 58 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 423 "ext/pdo/pdo_sql_parser.c" +#line 422 "ext/pdo/pdo_sql_parser.c" } #line 66 "ext/pdo/pdo_sql_parser.re" @@ -781,9 +780,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char padding = 3; } if(params) { - HashPosition *param_pos; - zend_hash_internal_pointer_reset(params); - while ((param == zend_hash_get_current_data_ptr_ex(params, ¶m_pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(params, param) { if(param->parameter) { convert_to_string(param->parameter); /* accommodate a string that needs to be fully quoted @@ -792,8 +789,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char */ newbuffer_len += padding * Z_STRLEN_P(param->parameter); } - zend_hash_move_forward(params); - } + } ZEND_HASH_FOREACH_END(); } *outquery = (char *) emalloc(newbuffer_len + 1); *outquery_len = 0; diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index ef989d35c4..1297e45db7 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -422,9 +422,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char padding = 3; } if(params) { - HashPosition *param_pos; - zend_hash_internal_pointer_reset(params); - while ((param == zend_hash_get_current_data_ptr_ex(params, ¶m_pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(params, param) { if(param->parameter) { convert_to_string(param->parameter); /* accommodate a string that needs to be fully quoted @@ -433,8 +431,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char */ newbuffer_len += padding * Z_STRLEN_P(param->parameter); } - zend_hash_move_forward(params); - } + } ZEND_HASH_FOREACH_END(); } *outquery = (char *) emalloc(newbuffer_len + 1); *outquery_len = 0; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 194c7ee99b..92b5d9da5f 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -447,36 +447,27 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in /* counting static properties */ count = zend_hash_num_elements(&ce->properties_info); if (count > 0) { - HashPosition pos; zend_property_info *prop; - zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); - - while ((prop = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) { if(prop->flags & ZEND_ACC_SHADOW) { count_shadow_props++; } else if (prop->flags & ZEND_ACC_STATIC) { count_static_props++; } - zend_hash_move_forward_ex(&ce->properties_info, &pos); - } + } ZEND_HASH_FOREACH_END(); } /* static properties */ string_printf(str, "\n%s - Static properties [%d] {\n", indent, count_static_props); if (count_static_props > 0) { - HashPosition pos; zend_property_info *prop; - zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); - - while ((prop = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) { if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) { _property_string(str, prop, NULL, sub_indent.buf->val); } - - zend_hash_move_forward_ex(&ce->properties_info, &pos); - } + } ZEND_HASH_FOREACH_END(); } string_printf(str, "%s }\n", indent); } @@ -486,38 +477,30 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in /* counting static methods */ count = zend_hash_num_elements(&ce->function_table); if (count > 0) { - HashPosition pos; zend_function *mptr; - zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); - - while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(&ce->function_table, mptr) { if (mptr->common.fn_flags & ZEND_ACC_STATIC && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { count_static_funcs++; } - zend_hash_move_forward_ex(&ce->function_table, &pos); - } + } ZEND_HASH_FOREACH_END(); } /* static methods */ string_printf(str, "\n%s - Static methods [%d] {", indent, count_static_funcs); if (count_static_funcs > 0) { - HashPosition pos; zend_function *mptr; - zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); - - while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(&ce->function_table, mptr) { if (mptr->common.fn_flags & ZEND_ACC_STATIC && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { string_printf(str, "\n"); _function_string(str, mptr, ce, sub_indent.buf->val); } - zend_hash_move_forward_ex(&ce->function_table, &pos); - } + } ZEND_HASH_FOREACH_END(); } else { string_printf(str, "\n"); } @@ -529,17 +512,13 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in count = zend_hash_num_elements(&ce->properties_info) - count_static_props - count_shadow_props; string_printf(str, "\n%s - Properties [%d] {\n", indent, count); if (count > 0) { - HashPosition pos; zend_property_info *prop; - zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); - - while ((prop = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) { + ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) { if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) { _property_string(str, prop, NULL, sub_indent.buf->val); } - zend_hash_move_forward_ex(&ce->properties_info, &pos); - } + } ZEND_HASH_FOREACH_END(); } string_printf(str, "%s }\n", indent); } @@ -547,29 +526,20 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in if (obj && Z_TYPE_P(obj) == IS_OBJECT && Z_OBJ_HT_P(obj)->get_properties) { string dyn; HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj); - HashPosition pos; - zval **prop; + zend_string *prop_name; string_init(&dyn); count = 0; if (properties && zend_hash_num_elements(properties)) { - zend_hash_internal_pointer_reset_ex(properties, &pos); - - while ((prop = zend_hash_get_current_data_ptr_ex(properties, &pos)) != NULL) { - zend_string *prop_name; - zend_ulong index; - - if (zend_hash_get_current_key_ex(properties, &prop_name, &index, &pos) == HASH_KEY_IS_STRING) { - if (prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */ - if (!zend_hash_exists(&ce->properties_info, prop_name)) { - count++; - _property_string(&dyn, NULL, prop_name->val, sub_indent.buf->val); - } + ZEND_HASH_FOREACH_STR_KEY(properties, prop_name) { + if (prop_name && prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */ + if (!zend_hash_exists(&ce->properties_info, prop_name)) { + count++; + _property_string(&dyn, NULL, prop_name->val, sub_indent.buf->val); } } - zend_hash_move_forward_ex(properties, &pos); - } + } ZEND_HASH_FOREACH_END(); } string_printf(str, "\n%s - Dynamic properties [%d] {\n", indent, count); @@ -582,26 +552,23 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in if (&ce->function_table) { count = zend_hash_num_elements(&ce->function_table) - count_static_funcs; if (count > 0) { - HashPosition pos; zend_function *mptr; + zend_string *key; string dyn; count = 0; string_init(&dyn); - zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); - while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) { + ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, key, mptr) { if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0 && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { - zend_string *key; - zend_ulong num_index; size_t len = mptr->common.function_name->len; /* Do not display old-style inherited constructors */ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || mptr->common.scope == ce - || zend_hash_get_current_key_ex(&ce->function_table, &key, &num_index, &pos) != HASH_KEY_IS_STRING + || !key || zend_binary_strcasecmp(key->val, key->len, mptr->common.function_name->val, len) == 0) { zend_function *closure; @@ -620,8 +587,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in _free_function(closure); } } - zend_hash_move_forward_ex(&ce->function_table, &pos); - } + } ZEND_HASH_FOREACH_END(); string_printf(str, "\n%s - Methods [%d] {", indent, count); if (!count) { string_printf(str, "\n"); @@ -777,10 +743,8 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i static void _function_closure_string(string *str, zend_function *fptr, char* indent) { uint32_t i, count; - zend_ulong num_index; zend_string *key; HashTable *static_variables; - HashPosition pos; if (fptr->type != ZEND_USER_FUNCTION || !fptr->op_array.static_variables) { return; @@ -795,13 +759,10 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind string_printf(str, "\n"); string_printf(str, "%s- Bound Variables [%d] {\n", indent, zend_hash_num_elements(static_variables)); - zend_hash_internal_pointer_reset_ex(static_variables, &pos); i = 0; - while (i < count) { - zend_hash_get_current_key_ex(static_variables, &key, &num_index, &pos); + ZEND_HASH_FOREACH_STR_KEY(static_variables, key) { string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, key->val); - zend_hash_move_forward_ex(static_variables, &pos); - } + } ZEND_HASH_FOREACH_END(); string_printf(str, "%s}\n", indent); } /* }}} */ @@ -1118,12 +1079,10 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde } { - HashPosition iterator; zend_function *fptr; int first = 1; - zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator); - while ((fptr = zend_hash_get_current_data_ptr_ex(CG(function_table), &iterator)) != NULL) { + ZEND_HASH_FOREACH_PTR(CG(function_table), fptr) { if (fptr->common.type==ZEND_INTERNAL_FUNCTION && fptr->internal_function.module == module) { if (first) { @@ -1132,8 +1091,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde } _function_string(str, fptr, NULL, " "); } - zend_hash_move_forward_ex(CG(function_table), &iterator); - } + } ZEND_HASH_FOREACH_END(); if (!first) { string_printf(str, "%s }\n", indent); } @@ -5300,7 +5258,6 @@ ZEND_METHOD(reflection_extension, getFunctions) { reflection_object *intern; zend_module_entry *module; - HashPosition iterator; zval function; zend_function *fptr; @@ -5310,15 +5267,13 @@ ZEND_METHOD(reflection_extension, getFunctions) GET_REFLECTION_OBJECT_PTR(module); array_init(return_value); - zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator); - while ((fptr = zend_hash_get_current_data_ptr_ex(CG(function_table), &iterator)) != NULL) { + ZEND_HASH_FOREACH_PTR(CG(function_table), fptr) { if (fptr->common.type==ZEND_INTERNAL_FUNCTION && fptr->internal_function.module == module) { reflection_function_factory(fptr, NULL, &function); zend_hash_update(Z_ARRVAL_P(return_value), fptr->common.function_name, &function); } - zend_hash_move_forward_ex(CG(function_table), &iterator); - } + } ZEND_HASH_FOREACH_END(); } /* }}} */ diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index 963db66818..f6a86315b1 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -217,17 +217,14 @@ static unsigned from_array_iterate(const zval *arr, void **args, ser_context *ctx) { - HashPosition pos; unsigned i; zval *elem; char buf[sizeof("element #4294967295")]; char *bufp = buf; /* Note i starts at 1, not 0! */ - for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos), i = 1; - !ctx->err.has_error - && (elem = zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), &pos)) != NULL; - zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos), i++) { + i = 1; + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), elem) { if (snprintf(buf, sizeof(buf), "element #%u", i) >= sizeof(buf)) { memcpy(buf, "element", sizeof("element")); } @@ -236,7 +233,11 @@ static unsigned from_array_iterate(const zval *arr, func(elem, i, args, ctx); zend_llist_remove_tail(&ctx->keys); - } + if (ctx->err.has_error) { + break; + } + i++; + } ZEND_HASH_FOREACH_END(); return i -1; } diff --git a/ext/standard/info.c b/ext/standard/info.c index e188a1287f..eb0a7ca131 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -102,7 +102,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht) /* {{{ * if (ht) { if (zend_hash_num_elements(ht)) { - HashPosition pos; + int first = 1; if (!sapi_module.phpinfo_as_text) { php_info_printf("<tr><td class=\"e\">Registered %s</td><td class=\"v\">", name); @@ -110,21 +110,20 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht) /* {{{ * php_info_printf("\nRegistered %s => ", name); } - zend_hash_internal_pointer_reset_ex(ht, &pos); - while (zend_hash_get_current_key_ex(ht, &key, NULL, &pos) == HASH_KEY_IS_STRING) - { - if (!sapi_module.phpinfo_as_text) { - php_info_print_html_esc(key->val, key->len); - } else { - php_info_print(key->val); - } - zend_hash_move_forward_ex(ht, &pos); - if (zend_hash_get_current_key_ex(ht, &key, NULL, &pos) == HASH_KEY_IS_STRING) { - php_info_print(", "); - } else { - break; + ZEND_HASH_FOREACH_STR_KEY(ht, key) { + if (key) { + if (first) { + first = 0; + } else { + php_info_print(", "); + } + if (!sapi_module.phpinfo_as_text) { + php_info_print_html_esc(key->val, key->len); + } else { + php_info_print(key->val); + } } - } + } ZEND_HASH_FOREACH_END(); if (!sapi_module.phpinfo_as_text) { php_info_print("</td></tr>\n"); diff --git a/main/output.c b/main/output.c index 50d4e5f1b3..09f8c9df6e 100644 --- a/main/output.c +++ b/main/output.c @@ -545,7 +545,6 @@ PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *op * Starts the set up output handler and pushes it on top of the stack. Checks for any conflicts regarding the output handler to start */ PHPAPI int php_output_handler_start(php_output_handler *handler) { - HashPosition pos; HashTable *rconflicts; php_output_handler_conflict_check_t conflict; @@ -558,14 +557,11 @@ PHPAPI int php_output_handler_start(php_output_handler *handler) } } if (NULL != (rconflicts = zend_hash_find_ptr(&php_output_handler_reverse_conflicts, handler->name))) { - for (zend_hash_internal_pointer_reset_ex(rconflicts, &pos); - (conflict = zend_hash_get_current_data_ptr_ex(rconflicts, &pos)) != NULL; - zend_hash_move_forward_ex(rconflicts, &pos) - ) { + ZEND_HASH_FOREACH_PTR(rconflicts, conflict) { if (SUCCESS != conflict(handler->name->val, handler->name->len)) { return FAILURE; } - } + } ZEND_HASH_FOREACH_END(); } /* zend_stack_push returns stack level */ handler->level = zend_stack_push(&OG(handlers), &handler); diff --git a/main/php_ini.c b/main/php_ini.c index 5703d1fc0d..9c16aa327d 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -782,16 +782,11 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { zend_string *str; zval *data; - zend_ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ - for (zend_hash_internal_pointer_reset(source_hash); - zend_hash_get_current_key(source_hash, &str, &num_index) == HASH_KEY_IS_STRING; - zend_hash_move_forward(source_hash) - ) { - data = zend_hash_get_current_data(source_hash); + ZEND_HASH_FOREACH_STR_KEY_VAL(source_hash, str, data) { zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0); - } + } ZEND_HASH_FOREACH_END(); } /* }}} */ diff --git a/main/streams/streams.c b/main/streams/streams.c index f1008a6631..7821c44c2e 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -123,28 +123,21 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream * if ((le = zend_hash_str_find_ptr(&EG(persistent_list), persistent_id, strlen(persistent_id))) != NULL) { if (le->type == le_pstream) { if (stream) { - HashPosition pos; - zend_resource *regentry; + zend_resource *regentry = NULL; /* see if this persistent resource already has been loaded to the * regular list; allowing the same resource in several entries in the * regular list causes trouble (see bug #54623) */ - zend_hash_internal_pointer_reset_ex(&EG(regular_list), &pos); - while ((regentry = zend_hash_get_current_data_ptr_ex(&EG(regular_list), &pos)) != NULL) { + *stream = (php_stream*)le->ptr; + ZEND_HASH_FOREACH_PTR(&EG(regular_list), regentry) { if (regentry->ptr == le->ptr) { - break; + GC_REFCOUNT(regentry)++; + (*stream)->res = regentry; + return PHP_STREAM_PERSISTENT_SUCCESS; } - zend_hash_move_forward_ex(&EG(regular_list), &pos); - } - - *stream = (php_stream*)le->ptr; - if (!regentry) { /* not found in regular list */ - GC_REFCOUNT(le)++; - (*stream)->res = zend_register_resource(*stream, le_pstream); - } else { - GC_REFCOUNT(regentry)++; - (*stream)->res = regentry; - } + } ZEND_HASH_FOREACH_END(); + GC_REFCOUNT(le)++; + (*stream)->res = zend_register_resource(*stream, le_pstream); } return PHP_STREAM_PERSISTENT_SUCCESS; } diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index de7546b5cd..636eee2d4b 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -139,13 +139,6 @@ static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, zval *zv, void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) { php_conf_rec *d = base_conf, *e = new_conf, *n = NULL; -#if STAS_0 - php_dir_entry *pe; - php_dir_entry *data; - char *str; - uint str_len; - ulong num_index; -#endif n = create_php_config(p, "merge_php_config"); /* copy old config */ @@ -155,20 +148,6 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n)); zend_hash_merge_ex(&n->config, &e->config, NULL, should_overwrite_per_dir_entry, NULL); //??? zend_hash_merge_ex(&n->config, &e->config, NULL, sizeof(php_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL); -#if STAS_0 - for (zend_hash_internal_pointer_reset(&d->config); - zend_hash_get_current_key(&d->config, &str, &str_len, - &num_index) == HASH_KEY_IS_STRING; - zend_hash_move_forward(&d->config)) { - pe = NULL; - zend_hash_get_current_data(&d->config, (void **) &data); - if (zend_hash_find(&n->config, str, str_len, (void **) &pe) == SUCCESS) { - if (pe->status >= data->status) continue; - } - phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1)); - zend_hash_update(&n->config, str, str_len, data, sizeof(*data), NULL); - } -#endif return n; } diff --git a/win32/registry.c b/win32/registry.c index 272246420b..3d4496094b 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -239,21 +239,11 @@ void UpdateIniFromRegistry(char *path) if (pht != NULL) { HashTable *ht = pht; zend_string *index; - zend_ulong num; zval *data; - ZEND_HASH_FOREACH_KEY_VAL(ht, num, index, data) { + ZEND_HASH_FOREACH_STR_KEY_VAL(ht, index, data) { zend_alter_ini_entry(index, Z_STR_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } ZEND_HASH_FOREACH_END(); -/* - for (zend_hash_internal_pointer_reset_ex(ht, &pos); - zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS && - zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING; - zend_hash_move_forward_ex(ht, &pos)) { - zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - } - break; -*/ } if (--path_len > 0) { |