From: Anatol Belski Date: Fri, 16 Feb 2018 10:45:07 +0000 (+0100) Subject: Reduce var scope X-Git-Tag: php-7.3.0alpha1~409 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=119be77051fe91cb1bfd7e8385b507f318d8a250;p=php Reduce var scope --- diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index fd03279390..f2e29aad27 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -169,7 +169,7 @@ PHP_FUNCTION(grapheme_strpos) Find position of first occurrence of a string within another, ignoring case differences */ PHP_FUNCTION(grapheme_stripos) { - char *haystack, *needle, *haystack_dup, *needle_dup; + char *haystack, *needle; size_t haystack_len, needle_len; const char *found; zend_long loffset = 0; @@ -201,6 +201,7 @@ PHP_FUNCTION(grapheme_stripos) is_ascii = ( grapheme_ascii_check((unsigned char*)haystack, haystack_len) >= 0 ); if ( is_ascii ) { + char *haystack_dup, *needle_dup; int32_t noffset = offset >= 0 ? offset : (int32_t)haystack_len + offset; needle_dup = estrndup(needle, needle_len); php_strtolower(needle_dup, needle_len); diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c index d81060b5a1..36b225a06c 100644 --- a/ext/intl/grapheme/grapheme_util.c +++ b/ext/intl/grapheme/grapheme_util.c @@ -138,7 +138,6 @@ int32_t grapheme_strpos_utf16(char *haystack, size_t haystack_len, char *needle, UBreakIterator* bi = NULL; UErrorCode status; UStringSearch* src = NULL; - UCollator *coll; if(puchar_pos) { *puchar_pos = -1; @@ -166,7 +165,7 @@ int32_t grapheme_strpos_utf16(char *haystack, size_t haystack_len, char *needle, STRPOS_CHECK_STATUS(status, "Error creating search object"); if(f_ignore_case) { - coll = usearch_getCollator(src); + UCollator *coll = usearch_getCollator(src); status = U_ZERO_ERROR; ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_SECONDARY, &status); STRPOS_CHECK_STATUS(status, "Error setting collation strength"); diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index adfa81f026..d2148cf58c 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -203,8 +203,6 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, int ustring_len = 0; UErrorCode status; zend_string *u8str; - UChar converted[MAXPATHLEN]; - int32_t converted_ret_len; /* convert the string to UTF-16. */ status = U_ZERO_ERROR; @@ -221,6 +219,8 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, RETURN_FALSE; } else { UParseError parse_error; + UChar converted[MAXPATHLEN]; + int32_t converted_ret_len; status = U_ZERO_ERROR; if (mode == INTL_IDN_TO_ASCII) {