From: Anatol Belski Date: Fri, 16 Feb 2018 11:27:49 +0000 (+0100) Subject: Remove unnecessary conditions and improve assignment X-Git-Tag: php-7.3.0alpha1~407 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f4598ec511c3877c6f75e7be5d10ecbe12a728f;p=php Remove unnecessary conditions and improve assignment --- diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 430ada100c..57b5ec5dd1 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -1330,12 +1330,8 @@ PHP_FUNCTION(locale_filter_matches) /* check if the char. after match is SEPARATOR */ chrcheck = token + (strlen(cur_loc_range)); if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ - if( cur_lang_tag){ - efree( cur_lang_tag ); - } - if( cur_loc_range){ - efree( cur_loc_range ); - } + efree( cur_lang_tag ); + efree( cur_loc_range ); if( can_lang_tag){ zend_string_release( can_lang_tag ); } @@ -1386,12 +1382,8 @@ PHP_FUNCTION(locale_filter_matches) /* check if the char. after match is SEPARATOR */ chrcheck = token + (strlen(cur_loc_range)); if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ - if( cur_lang_tag){ - efree( cur_lang_tag ); - } - if( cur_loc_range){ - efree( cur_loc_range ); - } + efree( cur_lang_tag ); + efree( cur_loc_range ); RETURN_TRUE; } } @@ -1433,7 +1425,6 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr, zend_string* lang_tag = NULL; zval* ele_value = NULL; - char** cur_arr = NULL; char* cur_loc_range = NULL; zend_string* can_loc_range = NULL; @@ -1441,7 +1432,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr, zend_string* return_value = NULL; - cur_arr = ecalloc(zend_hash_num_elements(hash_arr)*2, sizeof(char *)); + char **cur_arr = ecalloc(zend_hash_num_elements(hash_arr)*2, sizeof(char *)); ZEND_HASH_FOREACH_VAL(hash_arr, ele_value) { /* convert the array to lowercase , also replace hyphens with the underscore and store it in cur_arr */ if(Z_TYPE_P(ele_value)!= IS_STRING) {