X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_persistent_handle.c;h=5842035ed3a312a306a0450e63e6404c2a76571b;hb=d926a12aeec96752456eddfbf9a04a002809a0d2;hp=720e8e6f6d0daad292f43293159e49cf701250a8;hpb=a07b79b1871054ca17e48b69445b4dc201f24662;p=m6w6%2Fext-http diff --git a/php_http_persistent_handle.c b/php_http_persistent_handle.c index 720e8e6..5842035 100644 --- a/php_http_persistent_handle.c +++ b/php_http_persistent_handle.c @@ -6,13 +6,11 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner | + | Copyright (c) 2004-2011, Michael Wallner | +--------------------------------------------------------------------+ */ -/* $Id: http_persistent_handle_api.c 292841 2009-12-31 08:48:57Z mike $ */ - -#include "php_http.h" +#include "php_http_api.h" #ifndef PHP_HTTP_DEBUG_PHANDLES # define PHP_HTTP_DEBUG_PHANDLES 0 @@ -94,7 +92,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 +100,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 @@ -224,7 +222,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); @@ -247,7 +245,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) { @@ -316,7 +314,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(); @@ -337,7 +335,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(); @@ -356,7 +354,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(); @@ -376,7 +374,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); @@ -431,12 +429,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;