]> granicus.if.org Git - php/commitdiff
Rename locale_string to ctype_string
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 7 May 2020 16:45:03 +0000 (18:45 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 7 May 2020 16:45:03 +0000 (18:45 +0200)
To make it more obvious that this only refers to the LC_CTYPE
locale.

ext/pcre/php_pcre.c
ext/standard/basic_functions.c
ext/standard/basic_functions.h
ext/standard/string.c

index a5e806b30cb98bf79924b750254bfbaa4c7e35e5..611a18bd48bc9c8b3e7faea7f6ae1b7d58e73ff3 100644 (file)
@@ -595,10 +595,10 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
        zend_string             *key;
        pcre_cache_entry *ret;
 
-       if (locale_aware && BG(locale_string) &&
-               (ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
+       if (locale_aware && BG(ctype_string) &&
+               (ZSTR_LEN(BG(ctype_string)) != 1 && ZSTR_VAL(BG(ctype_string))[0] != 'C')) {
                key = zend_string_concat2(
-                       ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)),
+                       ZSTR_VAL(BG(ctype_string)), ZSTR_LEN(BG(ctype_string)),
                        ZSTR_VAL(regex), ZSTR_LEN(regex));
        } else {
                key = regex;
@@ -757,7 +757,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
        }
 
        if (key != regex) {
-               tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string));
+               tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(ctype_string));
                if (!tables) {
                        zend_string *_k;
                        tables = pcre2_maketables(gctx);
@@ -768,7 +768,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
                                efree(pattern);
                                return NULL;
                        }
-                       _k = zend_string_init(ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)), 1);
+                       _k = zend_string_init(ZSTR_VAL(BG(ctype_string)), ZSTR_LEN(BG(ctype_string)), 1);
                        GC_MAKE_PERSISTENT_LOCAL(_k);
                        zend_hash_add_ptr(&char_tables, _k, (void *)tables);
                        zend_string_release(_k);
index 5fa7be86dbe3c3ee87c431082cd81ffd6b30ea79..7e0f4e3da7898e6b63caadceeca5a2a597a52c9c 100755 (executable)
@@ -460,7 +460,7 @@ PHP_RINIT_FUNCTION(basic) /* {{{ */
        BG(strtok_string) = NULL;
        ZVAL_UNDEF(&BG(strtok_zval));
        BG(strtok_last) = NULL;
-       BG(locale_string) = NULL;
+       BG(ctype_string) = NULL;
        BG(locale_changed) = 0;
        BG(array_walk_fci) = empty_fcall_info;
        BG(array_walk_fci_cache) = empty_fcall_info_cache;
@@ -517,9 +517,9 @@ PHP_RSHUTDOWN_FUNCTION(basic) /* {{{ */
        if (BG(locale_changed)) {
                setlocale(LC_ALL, "C");
                zend_update_current_locale();
-               if (BG(locale_string)) {
-                       zend_string_release_ex(BG(locale_string), 0);
-                       BG(locale_string) = NULL;
+               if (BG(ctype_string)) {
+                       zend_string_release_ex(BG(ctype_string), 0);
+                       BG(ctype_string) = NULL;
                }
        }
 
index 2805addceafdf04603fe6fb0b42510bd12a33035..147bc1dd3a4c01a5e226e70a71955d920a6d43f7 100644 (file)
@@ -62,7 +62,7 @@ typedef struct _php_basic_globals {
        HashTable putenv_ht;
        zval  strtok_zval;
        char *strtok_string;
-       zend_string *locale_string; /* current LC_CTYPE locale (or NULL for 'C') */
+       zend_string *ctype_string; /* current LC_CTYPE locale (or NULL for 'C') */
        zend_bool locale_changed;   /* locale was changed and has to be restored */
        char *strtok_last;
        char strtok_table[256];
index b4a6b7c17e329e733ad4e5330276975cb0f31c0b..93ad0062442ddbf898b049bcc821fbd531215424 100644 (file)
@@ -4798,16 +4798,16 @@ PHP_FUNCTION(setlocale)
 
                                BG(locale_changed) = 1;
                                if (cat == LC_CTYPE || cat == LC_ALL) {
-                                       if (BG(locale_string)) {
-                                               zend_string_release_ex(BG(locale_string), 0);
+                                       if (BG(ctype_string)) {
+                                               zend_string_release_ex(BG(ctype_string), 0);
                                        }
                                        if (len == ZSTR_LEN(loc) && !memcmp(ZSTR_VAL(loc), retval, len)) {
-                                               BG(locale_string) = zend_string_copy(loc);
-                                               RETURN_STR(BG(locale_string));
+                                               BG(ctype_string) = zend_string_copy(loc);
+                                               RETURN_STR(BG(ctype_string));
                                        } else {
-                                               BG(locale_string) = zend_string_init(retval, len, 0);
+                                               BG(ctype_string) = zend_string_init(retval, len, 0);
                                                zend_string_release_ex(loc, 0);
-                                               RETURN_STR_COPY(BG(locale_string));
+                                               RETURN_STR_COPY(BG(ctype_string));
                                        }
                                } else if (len == ZSTR_LEN(loc) && !memcmp(ZSTR_VAL(loc), retval, len)) {
                                        RETURN_STR(loc);