From 4e0291650ff9c4da40df10e19160503e9fb57941 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Fri, 19 Sep 2025 16:35:32 +0200 Subject: [PATCH] Rename php_uri_parser free to destroy This is to fix Windows debug build when it is macro for _free_dbg --- ext/uri/php_uri.c | 8 ++++---- ext/uri/php_uri_common.h | 4 ++-- ext/uri/uri_parser_php_parse_url.c | 4 ++-- ext/uri/uri_parser_rfc3986.c | 8 ++++---- ext/uri/uri_parser_whatwg.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ext/uri/php_uri.c b/ext/uri/php_uri.c index c36d5f9b43c42..9967833ebaa93 100644 --- a/ext/uri/php_uri.c +++ b/ext/uri/php_uri.c @@ -167,7 +167,7 @@ ZEND_ATTRIBUTE_NONNULL PHPAPI zend_result php_uri_get_fragment(const uri_interna ZEND_ATTRIBUTE_NONNULL PHPAPI void php_uri_free(uri_internal_t *internal_uri) { - internal_uri->parser->free(internal_uri->uri); + internal_uri->parser->destroy(internal_uri->uri); internal_uri->uri = NULL; internal_uri->parser = NULL; efree(internal_uri); @@ -366,7 +366,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2) PHPAPI void php_uri_instantiate_uri( } if (pass_errors_by_ref_and_free(errors_zv, &errors) == FAILURE) { - uri_parser->free(uri); + uri_parser->destroy(uri); RETURN_THROWS(); } @@ -1045,7 +1045,7 @@ PHPAPI void php_uri_object_handler_free(zend_object *object) { uri_object_t *uri_object = uri_object_from_obj(object); - uri_object->internal.parser->free(uri_object->internal.uri); + uri_object->internal.parser->destroy(uri_object->internal.uri); zend_object_std_dtor(&uri_object->std); } @@ -1077,7 +1077,7 @@ PHPAPI zend_result php_uri_parser_register(const php_uri_parser *uri_parser) ZEND_ASSERT(uri_parser->parse != NULL); ZEND_ASSERT(uri_parser->clone != NULL || strcmp(uri_parser->name, PHP_URI_PARSER_PHP_PARSE_URL) == 0); ZEND_ASSERT(uri_parser->to_string != NULL || strcmp(uri_parser->name, PHP_URI_PARSER_PHP_PARSE_URL) == 0); - ZEND_ASSERT(uri_parser->free != NULL); + ZEND_ASSERT(uri_parser->destroy != NULL); zend_result result = zend_hash_add_ptr(&uri_parsers, key, (void *) uri_parser) != NULL ? SUCCESS : FAILURE; diff --git a/ext/uri/php_uri_common.h b/ext/uri/php_uri_common.h index ba5b0b2d7ee46..0932413486b20 100644 --- a/ext/uri/php_uri_common.h +++ b/ext/uri/php_uri_common.h @@ -119,11 +119,11 @@ typedef struct php_uri_parser { zend_string *(*to_string)(void *uri, php_uri_recomposition_mode recomposition_mode, bool exclude_fragment); /** - * Frees the provided URI. + * Destroy (free) the provided URI. * * @param uri The URI to free. Must do nothing if NULL. */ - void (*free)(void *uri); + void (*destroy)(void *uri); struct { php_uri_property_handler scheme; diff --git a/ext/uri/uri_parser_php_parse_url.c b/ext/uri/uri_parser_php_parse_url.c index cab8b68a4adf8..b8b3c8ae7d6d4 100644 --- a/ext/uri/uri_parser_php_parse_url.c +++ b/ext/uri/uri_parser_php_parse_url.c @@ -154,7 +154,7 @@ static void *uri_parser_php_parse_url_parse(const char *uri_str, size_t uri_str_ return url; } -static void uri_parser_php_parse_url_free(void *uri) +static void uri_parser_php_parse_url_destroy(void *uri) { php_url *parse_url_uri = uri; @@ -170,7 +170,7 @@ const php_uri_parser php_uri_parser_php_parse_url = { .parse = uri_parser_php_parse_url_parse, .clone = NULL, .to_string = NULL, - .free = uri_parser_php_parse_url_free, + .destroy = uri_parser_php_parse_url_destroy, { .scheme = {.read = uri_parser_php_parse_url_scheme_read, .write = NULL}, .username = {.read = uri_parser_php_parse_url_username_read, .write = NULL}, diff --git a/ext/uri/uri_parser_rfc3986.c b/ext/uri/uri_parser_rfc3986.c index c60c86efbfc36..0efae6d9db8c2 100644 --- a/ext/uri/uri_parser_rfc3986.c +++ b/ext/uri/uri_parser_rfc3986.c @@ -40,7 +40,7 @@ static void *php_uri_parser_rfc3986_memory_manager_reallocarray(UriMemoryManager return safe_erealloc(ptr, nmemb, size, 0); } -static void php_uri_parser_rfc3986_memory_manager_free(UriMemoryManager *memory_manager, void *ptr) +static void php_uri_parser_rfc3986_memory_manager_destroy(UriMemoryManager *memory_manager, void *ptr) { efree(ptr); } @@ -50,7 +50,7 @@ static const UriMemoryManager php_uri_parser_rfc3986_memory_manager = { .calloc = php_uri_parser_rfc3986_memory_manager_calloc, .realloc = php_uri_parser_rfc3986_memory_manager_realloc, .reallocarray = php_uri_parser_rfc3986_memory_manager_reallocarray, - .free = php_uri_parser_rfc3986_memory_manager_free, + .free = php_uri_parser_rfc3986_memory_manager_destroy, .userData = NULL, }; @@ -593,7 +593,7 @@ ZEND_ATTRIBUTE_NONNULL static zend_string *php_uri_parser_rfc3986_to_string(void return uri_string; } -static void php_uri_parser_rfc3986_free(void *uri) +static void php_uri_parser_rfc3986_destroy(void *uri) { php_uri_parser_rfc3986_uris *uriparser_uris = uri; @@ -612,7 +612,7 @@ const php_uri_parser php_uri_parser_rfc3986 = { .parse = php_uri_parser_rfc3986_parse, .clone = php_uri_parser_rfc3986_clone, .to_string = php_uri_parser_rfc3986_to_string, - .free = php_uri_parser_rfc3986_free, + .destroy = php_uri_parser_rfc3986_destroy, { .scheme = {.read = php_uri_parser_rfc3986_scheme_read, .write = php_uri_parser_rfc3986_scheme_write}, .username = {.read = php_uri_parser_rfc3986_username_read, .write = NULL}, diff --git a/ext/uri/uri_parser_whatwg.c b/ext/uri/uri_parser_whatwg.c index 70e7ccfc454be..99adaabc5b387 100644 --- a/ext/uri/uri_parser_whatwg.c +++ b/ext/uri/uri_parser_whatwg.c @@ -614,7 +614,7 @@ static zend_string *php_uri_parser_whatwg_to_string(void *uri, php_uri_recomposi return smart_str_extract(&uri_str); } -static void php_uri_parser_whatwg_free(void *uri) +static void php_uri_parser_whatwg_destroy(void *uri) { lxb_url_t *lexbor_uri = uri; @@ -626,7 +626,7 @@ const php_uri_parser php_uri_parser_whatwg = { .parse = php_uri_parser_whatwg_parse, .clone = php_uri_parser_whatwg_clone, .to_string = php_uri_parser_whatwg_to_string, - .free = php_uri_parser_whatwg_free, + .destroy = php_uri_parser_whatwg_destroy, { .scheme = {.read = php_uri_parser_whatwg_scheme_read, .write = php_uri_parser_whatwg_scheme_write}, .username = {.read = php_uri_parser_whatwg_username_read, .write = php_uri_parser_whatwg_username_write},