Skip to content

Commit

Permalink
use enum, maybe drop
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed May 12, 2023
1 parent bc25cb0 commit 11c447d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions locale.c
Expand Up @@ -1439,7 +1439,7 @@ S_parse_LC_ALL_string(pTHX_ const char * string,
* will be C for each ignored category and "" for the others. Then the
* caller can individually set each category, and get the right answer. */
if (single_component && ! isNAME_C_OR_POSIX(string)) {
for (locale_category_index i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
for (unsigned int i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
OVERRIDE_AND_SAVEPV(string, strlen(string), output[i], i, override);
}

Expand Down Expand Up @@ -1585,8 +1585,8 @@ S_parse_LC_ALL_string(pTHX_ const char * string,

# endif

{ /* Here is the name=value notation */
for (locale_category_index i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
{
for (unsigned int i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
if (! seen[i]) {
error = incomplete;
goto failure;
Expand All @@ -1612,7 +1612,7 @@ S_parse_LC_ALL_string(pTHX_ const char * string,
failure:

/* Don't leave memory dangling that we allocated before the failure */
for (locale_category_index i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
for (unsigned int i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
if (seen[i]) {
Safefree(output[i]);
output[i] = NULL;
Expand Down Expand Up @@ -1753,7 +1753,7 @@ S_posix_setlocale_with_complications(pTHX_ const int cat,
for result */
caller_line);

for (all_individual_category_indexes(i)) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
Safefree(new_locales[i]);
}

Expand Down Expand Up @@ -2938,7 +2938,7 @@ S_bool_setlocale_2008_i(pTHX_
/* Loop, using the previous iteration's result as the basis for the
* next one. (The first time we effectively use the locale in
* force upon entry to this function.) */
for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
new_obj = newlocale(category_masks[i],
new_locales[i],
basis_obj);
Expand Down Expand Up @@ -2967,7 +2967,7 @@ S_bool_setlocale_2008_i(pTHX_
}

/* Success for all categories. */
for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
update_PL_curlocales_i(i, new_locales[i], caller_line);
Safefree(new_locales[i]);
}
Expand Down Expand Up @@ -3120,7 +3120,7 @@ S_update_PL_curlocales_i(pTHX_
# ifdef LC_ALL

else { /* LC_ALL */
for (locale_category_index i = 0; i <= LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i <= LC_ALL_INDEX_; i++) {
Safefree(PL_curlocales[i]);
PL_curlocales[i] = NULL;
}
Expand Down Expand Up @@ -3325,7 +3325,7 @@ S_calculate_LC_ALL_string(pTHX_ const char ** category_locales_list,

/* The total length then is just the sum of the above boiler-plate plus the
* total strlen()s of the locale name of each individual category. */
for (locale_category_index i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
for (unsigned int i = 0; i < LOCALE_CATEGORIES_COUNT_; i++) {
const char * entry = ENTRY(i, locales_list, format);

total_len += strlen(entry);
Expand Down Expand Up @@ -4397,7 +4397,7 @@ S_new_LC_ALL(pTHX_ const char *unused, bool force)

/* LC_ALL updates all the things we care about. */

for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
if (update_functions[i]) {
const char * this_locale = querylocale_i(i);
update_functions[i](aTHX_ this_locale, force);
Expand Down Expand Up @@ -7133,7 +7133,7 @@ S_give_perl_locale_control(pTHX_

# else

for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
void_setlocale_i_with_caller(i, locales[i], __FILE__, caller_line);
}

Expand Down Expand Up @@ -7174,7 +7174,7 @@ S_output_check_environment_warning(pTHX_ const char * const language,
lc_all ? lc_all : "unset",
lc_all ? '"' : ')');

for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
const char * value = PerlEnv_getenv(category_names[i]);
PerlIO_printf(Perl_error_log,
"\t%s = %c%s%c,\n",
Expand Down Expand Up @@ -7530,7 +7530,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
# endif

//for (unsigned int i = 0; i <= LC_ALL_INDEX_; i++) {
for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
assert(category_name_lengths[i] == strlen(category_names[i]));
}

Expand All @@ -7548,7 +7548,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
wcrtomb(NULL, L'\0', &PL_wcrtomb_ps);
# endif
# ifdef EMULATE_THREAD_SAFE_LOCALES
for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
PL_restore_locale[i] = NULL;
}
# endif
Expand Down Expand Up @@ -7637,7 +7637,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
# endif
# ifdef USE_PL_CURLOCALES

for (locale_category_index i = 0; i <= LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i <= LC_ALL_INDEX_; i++) {
PL_curlocales[i] = savepv("C");
}

Expand Down Expand Up @@ -9353,7 +9353,7 @@ Perl_switch_to_global_locale(pTHX)

/* Set the global to what was our per-thread state */
POSIX_SETLOCALE_LOCK;
for (locale_category_index i = 0; i < LC_ALL_INDEX_; i++) {
for (unsigned int i = 0; i < LC_ALL_INDEX_; i++) {
posix_setlocale(categories[i], cur_thread_locales[i]);
}
POSIX_SETLOCALE_UNLOCK;
Expand Down

0 comments on commit 11c447d

Please sign in to comment.