]> granicus.if.org Git - php/commitdiff
Reduce var scope
authorAnatol Belski <ab@php.net>
Fri, 16 Feb 2018 10:45:07 +0000 (11:45 +0100)
committerAnatol Belski <ab@php.net>
Fri, 16 Feb 2018 11:52:59 +0000 (12:52 +0100)
ext/intl/grapheme/grapheme_string.c
ext/intl/grapheme/grapheme_util.c
ext/intl/idn/idn.c

index fd0327939011471c72f1d22795efcea131b0886b..f2e29aad27a2f7de0208ce2a948bb6e73063ac96 100644 (file)
@@ -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);
index d81060b5a1f855b7e0ce1272c093f4b7a184d71b..36b225a06ccea57dcdb6084423ab20aa7fa65022 100644 (file)
@@ -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");
index adfa81f02622337a2cacfa5d9b33c52bf46d808a..d2148cf58c5466176fedd840a97968e8fce253d3 100644 (file)
@@ -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) {