X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_cookie_api.c;h=5776b87caecd43d052efac87f3bb5e5b453a676a;hp=2f0d6c55fc7c57144aab811e6b8853667c2df035;hb=ad5f896b03adaa073134a00108a9cdf00720673a;hpb=23d7e7f276852b4ed1bd2829fcca38c6db854563 diff --git a/http_cookie_api.c b/http_cookie_api.c index 2f0d6c5..5776b87 100644 --- a/http_cookie_api.c +++ b/http_cookie_api.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2007, Michael Wallner | + | Copyright (c) 2004-2010, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -249,12 +249,9 @@ PHP_HTTP_API http_cookie_list *_http_cookie_list_fromstruct(http_cookie_list *li list->flags = (long) Z_DVAL_PP(tmp); break; case IS_STRING: - cpy = *tmp; - convert_to_long_ex(&cpy); - list->flags = Z_LVAL_PP(tmp); - if (cpy != *tmp) { - zval_ptr_dtor(&cpy); - } + cpy = http_zsep(IS_LONG, *tmp); + list->flags = Z_LVAL_P(cpy); + zval_ptr_dtor(&cpy); break; default: break; @@ -269,8 +266,7 @@ PHP_HTTP_API http_cookie_list *_http_cookie_list_fromstruct(http_cookie_list *li list->expires = (long) Z_DVAL_PP(tmp); break; case IS_STRING: - cpy = *tmp; - convert_to_long_ex(&cpy); + cpy = http_zsep(IS_LONG, *tmp); if (Z_LVAL_P(cpy)) { list->expires = Z_LVAL_P(cpy); } else { @@ -279,9 +275,7 @@ PHP_HTTP_API http_cookie_list *_http_cookie_list_fromstruct(http_cookie_list *li list->expires = expires; } } - if (cpy != *tmp) { - zval_ptr_dtor(&cpy); - } + zval_ptr_dtor(&cpy); break; default: break; @@ -329,7 +323,9 @@ PHP_HTTP_API void _http_cookie_list_tostring(http_cookie_list *list, char **str, FOREACH_HASH_KEYVAL(pos, &list->cookies, key, val) { if (key.type == HASH_KEY_IS_STRING && key.len) { - append_encoded(&buf, key.str, key.len-1, Z_STRVAL_PP(val), Z_STRLEN_PP(val)); + zval *tmp = http_zsep(IS_STRING, *val); + append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + zval_ptr_dtor(&tmp); } } @@ -347,7 +343,8 @@ PHP_HTTP_API void _http_cookie_list_tostring(http_cookie_list *list, char **str, FOREACH_HASH_KEYVAL(pos, &list->extras, key, val) { if (key.type == HASH_KEY_IS_STRING && key.len) { - append_encoded(&buf, key.str, key.len-1, Z_STRVAL_PP(val), Z_STRLEN_PP(val)); + zval *tmp = http_zsep(IS_STRING, *val); + append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } }