summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/output.c8
-rw-r--r--main/php_ini.c9
-rw-r--r--main/streams/streams.c25
3 files changed, 13 insertions, 29 deletions
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;
}