Skip to content

Commit 243aedd

Browse files
authored
uri: Remove useless uri_property_handlers_t struct (#19622)
* uri: Do not copy the `property_handlers` struct in `uri_get_debug_properties()` * uri: Remove now-useless `uri_property_handlers_t` struct This struct was just used for “namespacing” within the `uri_parser_t` struct. It is no longer referenced anywhere.
1 parent 22252b0 commit 243aedd

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

ext/uri/php_uri.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,38 +69,38 @@ static HashTable *uri_get_debug_properties(zend_object *object)
6969
return result;
7070
}
7171

72-
const uri_property_handlers_t property_handlers = internal_uri->parser->property_handlers;
72+
const uri_parser_t *parser = internal_uri->parser;
7373

7474
zval tmp;
75-
if (property_handlers.scheme.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
75+
if (parser->property_handlers.scheme.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
7676
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_SCHEME), &tmp);
7777
}
7878

79-
if (property_handlers.username.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
79+
if (parser->property_handlers.username.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
8080
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_USERNAME), &tmp);
8181
}
8282

83-
if (property_handlers.password.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
83+
if (parser->property_handlers.password.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
8484
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_PASSWORD), &tmp);
8585
}
8686

87-
if (property_handlers.host.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
87+
if (parser->property_handlers.host.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
8888
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_HOST), &tmp);
8989
}
9090

91-
if (property_handlers.port.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
91+
if (parser->property_handlers.port.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
9292
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_PORT), &tmp);
9393
}
9494

95-
if (property_handlers.path.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
95+
if (parser->property_handlers.path.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
9696
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_PATH), &tmp);
9797
}
9898

99-
if (property_handlers.query.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
99+
if (parser->property_handlers.query.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
100100
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_QUERY), &tmp);
101101
}
102102

103-
if (property_handlers.fragment.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
103+
if (parser->property_handlers.fragment.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
104104
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_FRAGMENT), &tmp);
105105
}
106106

ext/uri/php_uri_common.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ typedef struct uri_property_handler_t {
6464
uri_write_t write_func;
6565
} uri_property_handler_t;
6666

67-
typedef struct uri_property_handlers_t {
68-
uri_property_handler_t scheme;
69-
uri_property_handler_t username;
70-
uri_property_handler_t password;
71-
uri_property_handler_t host;
72-
uri_property_handler_t port;
73-
uri_property_handler_t path;
74-
uri_property_handler_t query;
75-
uri_property_handler_t fragment;
76-
} uri_property_handlers_t;
77-
7867
typedef struct uri_parser_t {
7968
/**
8069
* Name (the FQCN) of the URI parser. The "" name is reserved for the handler of the legacy parse_url().
@@ -138,7 +127,16 @@ typedef struct uri_parser_t {
138127
*/
139128
void (*free_uri)(void *uri);
140129

141-
const uri_property_handlers_t property_handlers;
130+
struct {
131+
uri_property_handler_t scheme;
132+
uri_property_handler_t username;
133+
uri_property_handler_t password;
134+
uri_property_handler_t host;
135+
uri_property_handler_t port;
136+
uri_property_handler_t path;
137+
uri_property_handler_t query;
138+
uri_property_handler_t fragment;
139+
} property_handlers;
142140
} uri_parser_t;
143141

144142
typedef struct uri_internal_t {

0 commit comments

Comments
 (0)