Skip to content

Commit 3642a7a

Browse files
committed
Add a few missing modifiers for ext/uri functions
- static modifier is added for php_uri_parser_rfc3986_parse() - const modifier is added for component read and write handler parameters
1 parent f26aae1 commit 3642a7a

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

ext/uri/uri_parser_rfc3986.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ZEND_ATTRIBUTE_NONNULL static UriUriA *get_normalized_uri(php_uri_parser_rfc3986
103103
return &uriparser_uris->normalized_uri;
104104
}
105105

106-
ZEND_ATTRIBUTE_NONNULL static UriUriA *get_uri_for_reading(php_uri_parser_rfc3986_uris *uriparser_uris, php_uri_component_read_mode read_mode)
106+
ZEND_ATTRIBUTE_NONNULL static UriUriA *get_uri_for_reading(php_uri_parser_rfc3986_uris *uriparser_uris, const php_uri_component_read_mode read_mode)
107107
{
108108
switch (read_mode) {
109109
case PHP_URI_COMPONENT_READ_MODE_RAW:
@@ -140,7 +140,7 @@ ZEND_ATTRIBUTE_NONNULL void php_uri_parser_rfc3986_uri_type_read(php_uri_parser_
140140
ZVAL_OBJ_COPY(retval, zend_enum_get_case_cstr(php_uri_ce_rfc3986_uri_type, type));
141141
}
142142

143-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_scheme_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
143+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_scheme_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
144144
{
145145
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
146146

@@ -177,7 +177,7 @@ static zend_result php_uri_parser_rfc3986_scheme_write(void *uri, const zval *va
177177
}
178178
}
179179

180-
ZEND_ATTRIBUTE_NONNULL zend_result php_uri_parser_rfc3986_userinfo_read(php_uri_parser_rfc3986_uris *uri, php_uri_component_read_mode read_mode, zval *retval)
180+
ZEND_ATTRIBUTE_NONNULL zend_result php_uri_parser_rfc3986_userinfo_read(php_uri_parser_rfc3986_uris *uri, const php_uri_component_read_mode read_mode, zval *retval)
181181
{
182182
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
183183

@@ -190,7 +190,7 @@ ZEND_ATTRIBUTE_NONNULL zend_result php_uri_parser_rfc3986_userinfo_read(php_uri_
190190
return SUCCESS;
191191
}
192192

193-
zend_result php_uri_parser_rfc3986_userinfo_write(php_uri_parser_rfc3986_uris *uri, zval *value, zval *errors)
193+
zend_result php_uri_parser_rfc3986_userinfo_write(php_uri_parser_rfc3986_uris *uri, const zval *value, zval *errors)
194194
{
195195
UriUriA *uriparser_uri = get_uri_for_writing(uri);
196196
int result;
@@ -217,7 +217,7 @@ zend_result php_uri_parser_rfc3986_userinfo_write(php_uri_parser_rfc3986_uris *u
217217
}
218218
}
219219

220-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_username_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
220+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_username_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
221221
{
222222
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
223223

@@ -239,7 +239,7 @@ ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_username_read(v
239239
return SUCCESS;
240240
}
241241

242-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_password_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
242+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_password_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
243243
{
244244
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
245245

@@ -258,7 +258,7 @@ ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_password_read(v
258258
return SUCCESS;
259259
}
260260

261-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_host_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
261+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_host_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
262262
{
263263
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
264264

@@ -335,7 +335,7 @@ static zend_result php_uri_parser_rfc3986_host_write(void *uri, const zval *valu
335335
}
336336
}
337337

338-
ZEND_ATTRIBUTE_NONNULL static zend_long port_str_to_zend_long_checked(const char *str, size_t len)
338+
ZEND_ATTRIBUTE_NONNULL static zend_long port_str_to_zend_long_checked(const char *str, const size_t len)
339339
{
340340
if (len > MAX_LENGTH_OF_LONG) {
341341
return -1;
@@ -353,7 +353,7 @@ ZEND_ATTRIBUTE_NONNULL static zend_long port_str_to_zend_long_checked(const char
353353
return (zend_long)result;
354354
}
355355

356-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_port_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
356+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_port_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
357357
{
358358
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
359359

@@ -395,7 +395,7 @@ static zend_result php_uri_parser_rfc3986_port_write(void *uri, const zval *valu
395395
}
396396
}
397397

398-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_path_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
398+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_path_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
399399
{
400400
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
401401

@@ -463,7 +463,7 @@ static zend_result php_uri_parser_rfc3986_path_write(void *uri, const zval *valu
463463
}
464464
}
465465

466-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_query_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
466+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_query_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
467467
{
468468
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
469469

@@ -500,7 +500,7 @@ static zend_result php_uri_parser_rfc3986_query_write(void *uri, const zval *val
500500
}
501501
}
502502

503-
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_fragment_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
503+
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_fragment_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
504504
{
505505
const UriUriA *uriparser_uri = get_uri_for_reading(uri, read_mode);
506506

@@ -619,7 +619,7 @@ php_uri_parser_rfc3986_uris *php_uri_parser_rfc3986_parse_ex(const char *uri_str
619619
return NULL;
620620
}
621621

622-
void *php_uri_parser_rfc3986_parse(const char *uri_str, size_t uri_str_len, const void *base_url, zval *errors, bool silent)
622+
static void *php_uri_parser_rfc3986_parse(const char *uri_str, const size_t uri_str_len, const void *base_url, zval *errors, bool silent)
623623
{
624624
return php_uri_parser_rfc3986_parse_ex(uri_str, uri_str_len, base_url, silent);
625625
}
@@ -637,7 +637,7 @@ ZEND_ATTRIBUTE_NONNULL static void *php_uri_parser_rfc3986_clone(void *uri)
637637
return new_uriparser_uris;
638638
}
639639

640-
ZEND_ATTRIBUTE_NONNULL static zend_string *php_uri_parser_rfc3986_to_string(void *uri, php_uri_recomposition_mode recomposition_mode, bool exclude_fragment)
640+
ZEND_ATTRIBUTE_NONNULL static zend_string *php_uri_parser_rfc3986_to_string(void *uri, const php_uri_recomposition_mode recomposition_mode, const bool exclude_fragment)
641641
{
642642
php_uri_parser_rfc3986_uris *uriparser_uris = uri;
643643
const UriUriA *uriparser_uri;

ext/uri/uri_parser_rfc3986.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ZEND_ATTRIBUTE_NONNULL void php_uri_parser_rfc3986_uri_type_read(php_uri_parser_
2525
ZEND_ATTRIBUTE_NONNULL void php_uri_parser_rfc3986_host_type_read(php_uri_parser_rfc3986_uris *uri, zval *retval);
2626

2727
zend_result php_uri_parser_rfc3986_userinfo_read(php_uri_parser_rfc3986_uris *uri, php_uri_component_read_mode read_mode, zval *retval);
28-
zend_result php_uri_parser_rfc3986_userinfo_write(php_uri_parser_rfc3986_uris *uri, zval *value, zval *errors);
28+
zend_result php_uri_parser_rfc3986_userinfo_write(php_uri_parser_rfc3986_uris *uri, const zval *value, zval *errors);
2929

3030
php_uri_parser_rfc3986_uris *php_uri_parser_rfc3986_parse_ex(const char *uri_str, size_t uri_str_len, const php_uri_parser_rfc3986_uris *uriparser_base_url, bool silent);
3131

ext/uri/uri_parser_whatwg.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static void throw_invalid_url_exception_during_write(zval *errors, const char *c
235235
}
236236
}
237237

238-
static lxb_status_t serialize_to_smart_str_callback(const lxb_char_t *data, size_t length, void *ctx)
238+
static lxb_status_t serialize_to_smart_str_callback(const lxb_char_t *data, const size_t length, void *ctx)
239239
{
240240
smart_str *uri_str = ctx;
241241

@@ -246,7 +246,7 @@ static lxb_status_t serialize_to_smart_str_callback(const lxb_char_t *data, size
246246
return LXB_STATUS_OK;
247247
}
248248

249-
static zend_result php_uri_parser_whatwg_scheme_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
249+
static zend_result php_uri_parser_whatwg_scheme_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
250250
{
251251
const lxb_url_t *lexbor_uri = uri;
252252

@@ -348,7 +348,7 @@ static zend_result php_uri_parser_whatwg_password_write(void *uri, const zval *v
348348
return SUCCESS;
349349
}
350350

351-
static zend_result php_uri_parser_whatwg_host_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
351+
static zend_result php_uri_parser_whatwg_host_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
352352
{
353353
const lxb_url_t *lexbor_uri = uri;
354354

@@ -435,7 +435,7 @@ static zend_result php_uri_parser_whatwg_host_write(void *uri, const zval *value
435435
return SUCCESS;
436436
}
437437

438-
static zend_result php_uri_parser_whatwg_port_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
438+
static zend_result php_uri_parser_whatwg_port_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
439439
{
440440
const lxb_url_t *lexbor_uri = uri;
441441

@@ -466,7 +466,7 @@ static zend_result php_uri_parser_whatwg_port_write(void *uri, const zval *value
466466
return SUCCESS;
467467
}
468468

469-
static zend_result php_uri_parser_whatwg_path_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
469+
static zend_result php_uri_parser_whatwg_path_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
470470
{
471471
const lxb_url_t *lexbor_uri = uri;
472472

@@ -497,7 +497,7 @@ static zend_result php_uri_parser_whatwg_path_write(void *uri, const zval *value
497497
return SUCCESS;
498498
}
499499

500-
static zend_result php_uri_parser_whatwg_query_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
500+
static zend_result php_uri_parser_whatwg_query_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
501501
{
502502
const lxb_url_t *lexbor_uri = uri;
503503

@@ -528,7 +528,7 @@ static zend_result php_uri_parser_whatwg_query_write(void *uri, const zval *valu
528528
return SUCCESS;
529529
}
530530

531-
static zend_result php_uri_parser_whatwg_fragment_read(void *uri, php_uri_component_read_mode read_mode, zval *retval)
531+
static zend_result php_uri_parser_whatwg_fragment_read(void *uri, const php_uri_component_read_mode read_mode, zval *retval)
532532
{
533533
const lxb_url_t *lexbor_uri = uri;
534534

@@ -606,7 +606,7 @@ ZEND_MODULE_POST_ZEND_DEACTIVATE_D(uri_parser_whatwg)
606606
return SUCCESS;
607607
}
608608

609-
lxb_url_t *php_uri_parser_whatwg_parse_ex(const char *uri_str, size_t uri_str_len, const lxb_url_t *lexbor_base_url, zval *errors, bool silent)
609+
lxb_url_t *php_uri_parser_whatwg_parse_ex(const char *uri_str, const size_t uri_str_len, const lxb_url_t *lexbor_base_url, zval *errors, const bool silent)
610610
{
611611
lxb_url_parser_clean(&lexbor_parser);
612612

@@ -630,7 +630,7 @@ lxb_url_t *php_uri_parser_whatwg_parse_ex(const char *uri_str, size_t uri_str_le
630630
return url;
631631
}
632632

633-
static void *php_uri_parser_whatwg_parse(const char *uri_str, size_t uri_str_len, const void *base_url, zval *errors, bool silent)
633+
static void *php_uri_parser_whatwg_parse(const char *uri_str, const size_t uri_str_len, const void *base_url, zval *errors, const bool silent)
634634
{
635635
return php_uri_parser_whatwg_parse_ex(uri_str, uri_str_len, base_url, errors, silent);
636636
}
@@ -642,7 +642,7 @@ static void *php_uri_parser_whatwg_clone(void *uri)
642642
return lxb_url_clone(lexbor_parser.mraw, lexbor_uri);
643643
}
644644

645-
static zend_string *php_uri_parser_whatwg_to_string(void *uri, php_uri_recomposition_mode recomposition_mode, bool exclude_fragment)
645+
static zend_string *php_uri_parser_whatwg_to_string(void *uri, const php_uri_recomposition_mode recomposition_mode, const bool exclude_fragment)
646646
{
647647
const lxb_url_t *lexbor_uri = uri;
648648
smart_str uri_str = {0};

0 commit comments

Comments
 (0)