]> granicus.if.org Git - php/commitdiff
Removed declaration inside for loops
authorMatteo Beccati <mbeccati@php.net>
Fri, 29 Mar 2019 13:24:09 +0000 (14:24 +0100)
committerMatteo Beccati <mbeccati@php.net>
Fri, 29 Mar 2019 13:24:09 +0000 (14:24 +0100)
ext/mbstring/mbstring.c

index 48436550a405e6fcda79c77ccbe04a8e98caf428..cf0b08be6ed9c29f63f616ce4165da977f7846b7 100644 (file)
@@ -2367,7 +2367,9 @@ PHP_FUNCTION(mb_str_split)
                while (p < last) { /* split cycle work until the cursor has reached the last byte */
                        char const *chunk_p = p; /* chunk first byte pointer */
                        chunk_len = 0; /* chunk length in bytes */
-                       for (zend_long char_count = 0; char_count < split_length && p < last; ++char_count) {
+                       zend_long char_count;
+
+                       for (char_count = 0; char_count < split_length && p < last; ++char_count) {
                                char unsigned const m = mbtab[*(const unsigned char *)p]; /* single character length table */
                                chunk_len += m;
                                p += m;
@@ -2435,7 +2437,9 @@ PHP_FUNCTION(mb_str_split)
        chunks = (mb_len + split_length - 1) / split_length; /* (round up idiom) */
        array_init_size(return_value, chunks);
        if (chunks != 0) {
-               for (zend_long i = 0; i < chunks - 1; p += chunk_len, ++i) {
+               zend_long i;
+
+               for (i = 0; i < chunks - 1; p += chunk_len, ++i) {
                        add_next_index_stringl(return_value, p, chunk_len);
                }
                add_next_index_stringl(return_value, p, last - p);