X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_persistent_handle.c;h=c174a043d19d8a3344980a9c7cb261b45eb5ca57;hp=55d53d0059e43f84cf8276ba3a62b70ebb754119;hb=4062420a5e5d301db4a3d820be881e7675a242e1;hpb=7dc5de0b79846bfe33ca36a9eeb894ef2ecfdee1 diff --git a/php_http_persistent_handle.c b/php_http_persistent_handle.c index 55d53d0..c174a04 100644 --- a/php_http_persistent_handle.c +++ b/php_http_persistent_handle.c @@ -94,7 +94,7 @@ static inline php_http_persistent_handle_list_t *php_http_persistent_handle_list { php_http_persistent_handle_list_t **list, *new_list; - if (SUCCESS == zend_hash_find(&provider->list.free, ident_str, ident_len + 1, (void *) &list)) { + if (SUCCESS == zend_symtable_find(&provider->list.free, ident_str, ident_len + 1, (void *) &list)) { #if PHP_HTTP_DEBUG_PHANDLES fprintf(stderr, "LSTFIND: %p\n", *list); #endif @@ -102,7 +102,7 @@ static inline php_http_persistent_handle_list_t *php_http_persistent_handle_list } if ((new_list = php_http_persistent_handle_list_init(NULL))) { - if (SUCCESS == zend_hash_add(&provider->list.free, ident_str, ident_len + 1, (void *) &new_list, sizeof(php_http_persistent_handle_list_t *), (void *) &list)) { + if (SUCCESS == zend_symtable_update(&provider->list.free, ident_str, ident_len + 1, (void *) &new_list, sizeof(php_http_persistent_handle_list_t *), (void *) &list)) { #if PHP_HTTP_DEBUG_PHANDLES fprintf(stderr, "LSTFIND: %p (new)\n", *list); #endif @@ -182,6 +182,7 @@ static void php_http_persistent_handles_hash_dtor(void *p) php_http_persistent_handle_provider_t *provider = (php_http_persistent_handle_provider_t *) p; php_http_persistent_handle_list_t **list, *list_tmp; HashPosition pos; + TSRMLS_FETCH(); FOREACH_HASH_VAL(pos, &provider->list.free, list) { /* fix shutdown crash in PHP4 */ @@ -223,7 +224,7 @@ PHP_HTTP_API STATUS php_http_persistent_handle_provide(const char *name_str, siz fprintf(stderr, "PROVIDE: %s\n", name_str); #endif - if (SUCCESS == zend_hash_add(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider, sizeof(php_http_persistent_handle_provider_t), NULL)) { + if (SUCCESS == zend_symtable_update(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider, sizeof(php_http_persistent_handle_provider_t), NULL)) { status = SUCCESS; } else { php_http_resource_factory_dtor(&provider.rf); @@ -246,7 +247,7 @@ PHP_HTTP_API php_http_persistent_handle_factory_t *php_http_persistent_handle_co memset(a, 0, sizeof(*a)); LOCK(); - status = zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &a->provider); + status = zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &a->provider); UNLOCK(); if (SUCCESS == status) { @@ -304,7 +305,7 @@ PHP_HTTP_API void *php_http_persistent_handle_accrete(php_http_persistent_handle PHP_HTTP_API void php_http_persistent_handle_release(php_http_persistent_handle_factory_t *a, void *handle TSRMLS_DC) { LOCK(); - php_http_persistent_handle_do_release(a->provider, a->ident.str, a->ident.len, &handle); + php_http_persistent_handle_do_release(a->provider, a->ident.str, a->ident.len, &handle TSRMLS_CC); UNLOCK(); } @@ -315,7 +316,7 @@ PHP_HTTP_API STATUS php_http_persistent_handle_acquire2(const char *name_str, si *handle = NULL; LOCK(); - if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { + if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { status = php_http_persistent_handle_do_acquire(provider, ident_str, ident_len, handle TSRMLS_CC); } UNLOCK(); @@ -336,7 +337,7 @@ PHP_HTTP_API STATUS php_http_persistent_handle_release2(const char *name_str, si #endif LOCK(); - if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { + if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { status = php_http_persistent_handle_do_release(provider, ident_str, ident_len, handle TSRMLS_CC); } UNLOCK(); @@ -355,7 +356,7 @@ PHP_HTTP_API STATUS php_http_persistent_handle_accrete2(const char *name_str, si *new_handle = NULL; LOCK(); - if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { + if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { status = php_http_persistent_handle_do_accrete(provider, ident_str, ident_len, old_handle, new_handle TSRMLS_CC); } UNLOCK(); @@ -375,7 +376,7 @@ PHP_HTTP_API void php_http_persistent_handle_cleanup(const char *name_str, size_ LOCK(); if (name_str && name_len) { - if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { + if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) { if (ident_str && ident_len) { if ((list = php_http_persistent_handle_list_find(provider, ident_str, ident_len TSRMLS_CC))) { php_http_persistent_handle_list_dtor(list, provider TSRMLS_CC); @@ -430,12 +431,10 @@ PHP_HTTP_API HashTable *php_http_persistent_handle_statall(HashTable *ht TSRMLS_ array_init(zentry[1]); add_assoc_long_ex(zentry[1], ZEND_STRS("used"), (*list)->used); add_assoc_long_ex(zentry[1], ZEND_STRS("free"), zend_hash_num_elements(&(*list)->free)); - - /* use zend_hash_* not add_assoc_* (which is zend_symtable_*) as we want a string even for numbers */ - zend_hash_add(Z_ARRVAL_P(zentry[0]), key2.str, key2.len, &zentry[1], sizeof(zval *), NULL); + add_assoc_zval_ex(zentry[0], key2.str, key2.len, zentry[1]); } - zend_hash_add(ht, key1.str, key1.len, &zentry[0], sizeof(zval *), NULL); + zend_symtable_update(ht, key1.str, key1.len, &zentry[0], sizeof(zval *), NULL); } } else if (ht) { ht = NULL;