From 2e1cd7f9942bb07d7c3a2efb79090215fc1406d6 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 4 Oct 2005 14:34:26 +0000 Subject: [PATCH] - rename http_absolute_uri to http_build_uri (complements http_build_query) - ditch memleak in the HTTP_DO_NEGOTIATE() macro --- http.c | 3 ++- http_functions.c | 5 +++-- http_util_object.c | 4 ++-- php_http.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/http.c b/http.c index f7f0f31..2402ccb 100644 --- a/http.c +++ b/http.c @@ -75,7 +75,8 @@ ZEND_GET_MODULE(http) zend_function_entry http_functions[] = { PHP_FE(http_test, NULL) PHP_FE(http_date, NULL) - PHP_FE(http_absolute_uri, NULL) + PHP_FE(http_build_uri, NULL) + PHP_FALIAS(http_absolute_uri, http_build_uri, NULL) PHP_FE(http_negotiate_language, NULL) PHP_FE(http_negotiate_charset, NULL) PHP_FE(http_redirect, NULL) diff --git a/http_functions.c b/http_functions.c index 7d7eec4..9265d22 100644 --- a/http_functions.c +++ b/http_functions.c @@ -69,7 +69,7 @@ PHP_FUNCTION(http_date) } /* }}} */ -/* {{{ proto string http_absolute_uri(string url[, string proto[, string host[, int port]]]) +/* {{{ proto string http_build_uri(string url[, string proto[, string host[, int port]]]) * * This function returns an absolute URI constructed from url. * If the url is already abolute but a different proto was supplied, @@ -86,7 +86,7 @@ PHP_FUNCTION(http_date) * * */ -PHP_FUNCTION(http_absolute_uri) +PHP_FUNCTION(http_build_uri) { char *url = NULL, *proto = NULL, *host = NULL; int url_len = 0, proto_len = 0, host_len = 0; @@ -118,6 +118,7 @@ PHP_FUNCTION(http_absolute_uri) RETVAL_NULL(); \ } \ zend_hash_destroy(result); \ + FREE_HASHTABLE(result); \ } \ } else { \ if (as_array) { \ diff --git a/http_util_object.c b/http_util_object.c index 1feabad..024089d 100644 --- a/http_util_object.c +++ b/http_util_object.c @@ -36,7 +36,7 @@ HTTP_BEGIN_ARGS(date, 0) HTTP_ARG_VAL(timestamp, 0) HTTP_END_ARGS; -HTTP_BEGIN_ARGS(absoluteUri, 1) +HTTP_BEGIN_ARGS(buildUri, 1) HTTP_ARG_VAL(url, 0) HTTP_ARG_VAL(proto, 0) HTTP_ARG_VAL(host, 0) @@ -84,7 +84,7 @@ HTTP_END_ARGS; zend_class_entry *http_util_object_ce; zend_function_entry http_util_object_fe[] = { HTTP_UTIL_ALIAS(date, http_date) - HTTP_UTIL_ALIAS(absoluteUri, http_absolute_uri) + HTTP_UTIL_ALIAS(buildUri, http_build_uri) HTTP_UTIL_ALIAS(negotiateLanguage, http_negotiate_language) HTTP_UTIL_ALIAS(negotiateCharset, http_negotiate_charset) HTTP_UTIL_ALIAS(matchModified, http_match_modified) diff --git a/php_http.h b/php_http.h index 1079eaf..3bd580e 100644 --- a/php_http.h +++ b/php_http.h @@ -94,7 +94,7 @@ ZEND_END_MODULE_GLOBALS(http) PHP_FUNCTION(http_test); PHP_FUNCTION(http_date); -PHP_FUNCTION(http_absolute_uri); +PHP_FUNCTION(http_build_uri); PHP_FUNCTION(http_negotiate_language); PHP_FUNCTION(http_negotiate_charset); PHP_FUNCTION(http_redirect); -- 2.30.2