build and file maintenance
[m6w6/ext-http] / php_http_cookie.c
index 35b372886de9567bcc6efe68ee26f9325ddfd49f..1bfa734fd60ebc8c05bd1830cb086600c97e1c94 100644 (file)
@@ -6,12 +6,10 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2011, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
-/* $Id: http_cookie_api.c 298662 2010-04-27 13:42:32Z mike $ */
-
 #include "php_http.h"
 
 #include <ext/date/php_date.h>
@@ -79,7 +77,7 @@ PHP_HTTP_API void php_http_cookie_list_free(php_http_cookie_list_t **list)
 PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len)
 {
        zval **cookie = NULL;
-       if ((SUCCESS != zend_hash_find(&list->cookies, name, name_len + 1, (void *) &cookie)) || (Z_TYPE_PP(cookie) != IS_STRING)) {
+       if ((SUCCESS != zend_symtable_find(&list->cookies, name, name_len + 1, (void *) &cookie)) || (Z_TYPE_PP(cookie) != IS_STRING)) {
                return NULL;
        }
        return Z_STRVAL_PP(cookie);
@@ -90,7 +88,7 @@ PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t
 PHP_HTTP_API const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len)
 {
        zval **extra = NULL;
-       if ((SUCCESS != zend_hash_find(&list->extras, name, name_len + 1, (void *) &extra)) || (Z_TYPE_PP(extra) != IS_STRING)) {
+       if ((SUCCESS != zend_symtable_find(&list->extras, name, name_len + 1, (void *) &extra)) || (Z_TYPE_PP(extra) != IS_STRING)) {
                return NULL;
        }
        return Z_STRVAL_PP(extra);
@@ -104,7 +102,7 @@ PHP_HTTP_API void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list,
 
        MAKE_STD_ZVAL(cookie_value);
        ZVAL_STRINGL(cookie_value, estrndup(value, value_len), value_len, 0);
-       zend_hash_update(&list->cookies, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
+       zend_symtable_update(&list->cookies, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
 }
 
 
@@ -115,7 +113,7 @@ PHP_HTTP_API void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, c
 
        MAKE_STD_ZVAL(cookie_value);
        ZVAL_STRINGL(cookie_value, estrndup(value, value_len), value_len, 0);
-       zend_hash_update(&list->extras, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
+       zend_symtable_update(&list->extras, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
 }
 
 
@@ -669,7 +667,7 @@ PHP_METHOD(HttpCookie, getCookie)
                if (!obj->list) {
                        obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
                }
-               if (SUCCESS == zend_hash_find(&obj->list->cookies, name_str, name_len + 1, (void *) &zvalue)) {
+               if (SUCCESS == zend_symtable_find(&obj->list->cookies, name_str, name_len + 1, (void *) &zvalue)) {
                        RETURN_ZVAL(*zvalue, 1, 0);
                }
        }
@@ -688,13 +686,13 @@ PHP_METHOD(HttpCookie, setCookie)
                        obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
                }
                if (!value_str) {
-                       zend_hash_del(&obj->list->cookies, name_str, name_len + 1);
+                       zend_symtable_del(&obj->list->cookies, name_str, name_len + 1);
                } else {
                        zval *zvalue;
 
                        MAKE_STD_ZVAL(zvalue);
                        ZVAL_STRINGL(zvalue, value_str, value_len, 1);
-                       zend_hash_update(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+                       zend_symtable_update(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
                }
        }
        RETVAL_ZVAL(getThis(), 1, 0);
@@ -714,7 +712,7 @@ PHP_METHOD(HttpCookie, addCookie)
                }
                MAKE_STD_ZVAL(zvalue);
                ZVAL_STRINGL(zvalue, value_str, value_len, 1);
-               zend_hash_add(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+               zend_symtable_update(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
        }
        RETVAL_ZVAL(getThis(), 1, 0);
 }
@@ -731,7 +729,7 @@ PHP_METHOD(HttpCookie, getExtra)
                if (!obj->list) {
                        obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
                }
-               if (SUCCESS == zend_hash_find(&obj->list->extras, name_str, name_len + 1, (void *) &zvalue)) {
+               if (SUCCESS == zend_symtable_find(&obj->list->extras, name_str, name_len + 1, (void *) &zvalue)) {
                        RETURN_ZVAL(*zvalue, 1, 0);
                }
        }
@@ -750,13 +748,13 @@ PHP_METHOD(HttpCookie, setExtra)
                        obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
                }
                if (!value_str) {
-                       zend_hash_del(&obj->list->extras, name_str, name_len + 1);
+                       zend_symtable_del(&obj->list->extras, name_str, name_len + 1);
                } else {
                        zval *zvalue;
 
                        MAKE_STD_ZVAL(zvalue);
                        ZVAL_STRINGL(zvalue, value_str, value_len, 1);
-                       zend_hash_update(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+                       zend_symtable_update(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
                }
        }
        RETVAL_ZVAL(getThis(), 1, 0);
@@ -776,7 +774,7 @@ PHP_METHOD(HttpCookie, addExtra)
                }
                MAKE_STD_ZVAL(zvalue);
                ZVAL_STRINGL(zvalue, value_str, value_len, 1);
-               zend_hash_add(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+               zend_symtable_update(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
        }
        RETVAL_ZVAL(getThis(), 1, 0);
 }