Skip to content

Commit fa21d10

Browse files
committed
Improve name + comment
1 parent b0246d4 commit fa21d10

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sapi/cli/php_cli_server.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static bool php_cli_server_get_system_time(char *buf) {
267267
#endif
268268

269269
/* Destructor for php_cli_server_request->headers, this frees header value */
270-
static void char_ptr_dtor_p(zval *zv) /* {{{ */
270+
static void cli_header_value_dtor(zval *zv) /* {{{ */
271271
{
272272
zend_string_release_ex(Z_STR_P(zv), /* persistent */ true);
273273
} /* }}} */
@@ -1335,7 +1335,7 @@ static void php_cli_server_request_ctor(php_cli_server_request *req) /* {{{ */
13351335
req->path_info_len = 0;
13361336
req->query_string = NULL;
13371337
req->query_string_len = 0;
1338-
zend_hash_init(&req->headers, 0, NULL, char_ptr_dtor_p, 1);
1338+
zend_hash_init(&req->headers, 0, NULL, cli_header_value_dtor, 1);
13391339
/* No destructor is registered as the value pointed by is the same as for &req->headers */
13401340
zend_hash_init(&req->headers_original_case, 0, NULL, NULL, 1);
13411341
req->content = NULL;
@@ -1876,7 +1876,8 @@ static void php_cli_server_client_ctor(php_cli_server_client *client, php_cli_se
18761876
client->addr = addr;
18771877
client->addr_len = addr_len;
18781878

1879-
// TODO Prevent realloc?
1879+
// TODO To prevent the reallocation need to retrieve a persistent string
1880+
// Create a new php_network_populate_name_from_sockaddr_ex() API with a persistent flag?
18801881
zend_string *tmp_addr = NULL;
18811882
php_network_populate_name_from_sockaddr(addr, addr_len, &tmp_addr, NULL, 0);
18821883
client->addr_str = zend_string_dup(tmp_addr, /* persistent */ true);

0 commit comments

Comments
 (0)