Skip to content

Commit 16b3bbc

Browse files
committed
ext/intl: reuse known string lengths
1 parent bffa347 commit 16b3bbc

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

ext/intl/locale/locale_methods.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static zend_string* get_icu_value_internal( const char* loc_name , char* tag_nam
455455
efree( mod_loc_name);
456456
}
457457

458-
tag_value->len = strlen(tag_value->val);
458+
tag_value->len = buflen;
459459
return tag_value;
460460
}
461461
/* }}} */
@@ -738,7 +738,7 @@ PHP_FUNCTION( locale_get_keywords )
738738
Z_PARAM_STRING(loc_name, loc_name_len)
739739
ZEND_PARSE_PARAMETERS_END();
740740

741-
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
741+
INTL_CHECK_LOCALE_LEN(loc_name_len);
742742

743743
if(loc_name_len == 0) {
744744
loc_name = (char *)intl_locale_get_default();
@@ -1129,7 +1129,7 @@ PHP_FUNCTION(locale_parse)
11291129
Z_PARAM_STRING(loc_name, loc_name_len)
11301130
ZEND_PARSE_PARAMETERS_END();
11311131

1132-
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
1132+
INTL_CHECK_LOCALE_LEN(loc_name_len);
11331133

11341134
if(loc_name_len == 0) {
11351135
loc_name = (char *)intl_locale_get_default();
@@ -1322,7 +1322,7 @@ PHP_FUNCTION(locale_filter_matches)
13221322

13231323
if( token && (token==cur_lang_tag) ){
13241324
/* check if the char. after match is SEPARATOR */
1325-
chrcheck = token + (strlen(cur_loc_range));
1325+
chrcheck = token + can_loc_range->len;
13261326
if( isIDSeparator(*chrcheck) || isKeywordSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
13271327
efree( cur_lang_tag );
13281328
efree( cur_loc_range );
@@ -1354,14 +1354,14 @@ PHP_FUNCTION(locale_filter_matches)
13541354
} /* end of if isCanonical */
13551355
else{
13561356
/* Convert to lower case for case-insensitive comparison */
1357-
cur_lang_tag = ecalloc( 1, strlen(lang_tag ) + 1);
1357+
cur_lang_tag = ecalloc(1, lang_tag_len + 1);
13581358

13591359
result = strToMatch( lang_tag , cur_lang_tag);
13601360
if( result == 0) {
13611361
efree( cur_lang_tag );
13621362
RETURN_FALSE;
13631363
}
1364-
cur_loc_range = ecalloc( 1, strlen(loc_range ) + 1);
1364+
cur_loc_range = ecalloc(1, loc_range_len + 1);
13651365
result = strToMatch( loc_range , cur_loc_range );
13661366
if( result == 0) {
13671367
efree( cur_lang_tag );
@@ -1374,7 +1374,7 @@ PHP_FUNCTION(locale_filter_matches)
13741374

13751375
if( token && (token==cur_lang_tag) ){
13761376
/* check if the char. after match is SEPARATOR */
1377-
chrcheck = token + (strlen(cur_loc_range));
1377+
chrcheck = token + loc_range_len;
13781378
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
13791379
efree( cur_lang_tag );
13801380
efree( cur_loc_range );

0 commit comments

Comments
 (0)