Skip to content

Commit

Permalink
Revert "PLcurlocales"
Browse files Browse the repository at this point in the history
This reverts commit cd1fd76eac05b9ca866bb6f1dae6151767aa3d76.
  • Loading branch information
khwilliamson committed May 5, 2021
1 parent 5f53d48 commit 12734a6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
1 change: 0 additions & 1 deletion embedvar.h
Expand Up @@ -111,7 +111,6 @@
#define PL_curcop (vTHX->Icurcop)
#define PL_curcopdb (vTHX->Icurcopdb)
#define PL_curlocales (vTHX->Icurlocales)
#define PL_curlocales_sizes (vTHX->Icurlocales_sizes)
#define PL_curpad (vTHX->Icurpad)
#define PL_curpm (vTHX->Icurpm)
#define PL_curpm_under (vTHX->Icurpm_under)
Expand Down
15 changes: 7 additions & 8 deletions intrpvar.h
Expand Up @@ -367,14 +367,6 @@ PERLVAR(I, utf8locale, bool) /* utf8 locale detected */
PERLVAR(I, in_utf8_CTYPE_locale, bool)
PERLVAR(I, in_utf8_COLLATE_locale, bool)
PERLVAR(I, in_utf8_turkic_locale, bool)

#ifdef USE_PL_CURLOCALES
/* This is the most number of categories we've encountered so far on any
* platform */
PERLVARA(I, curlocales, 12, const char *)
PERLVARA(I, curlocales_sizes, 12, Size_t)
#endif

#if defined(USE_LOCALE) && defined(USE_LOCALE_THREADS)
PERLVARI(I, locale_mutex_depth, int, 0) /* Emulate general semaphore */
#endif
Expand Down Expand Up @@ -725,6 +717,13 @@ PERLVAR(I, constpadix, PADOFFSET) /* lowest unused for constants */

PERLVAR(I, padix_floor, PADOFFSET) /* how low may inner block reset padix */

#ifdef USE_PL_CURLOCALES

/* This is the most number of categories we've encountered so far on any
* platform */
PERLVARA(I, curlocales, 12, const char *)

#endif
#ifdef USE_LOCALE_COLLATE

PERLVAR(I, collation_name, char *) /* Name of current collation */
Expand Down
15 changes: 10 additions & 5 deletions locale.c
Expand Up @@ -854,23 +854,27 @@ S_update_PL_curlocales_i(pTHX_
/* PL_curlocales is a parallel array, so has same
* length as 'categories' */
for (i = 0; i < LC_ALL_INDEX_; i++) {
save_to_buffer(new_locale, &PL_curlocales[i], &PL_curlocales_sizes[i]);
Safefree(PL_curlocales[i]);
PL_curlocales[i] = savepv(new_locale);
}

recalc_LC_ALL = TRUE;
}
else {

/* Update the single category's record */
save_to_buffer(new_locale, &PL_curlocales[index], &PL_curlocales_sizes[index]);
Safefree(PL_curlocales[index]);
PL_curlocales[index] = savepv(new_locale);

if (recalc_LC_ALL == LOOPING) {
recalc_LC_ALL = (index == NOMINAL_LC_ALL_INDEX - 1);
}
}

if (recalc_LC_ALL) { /* And recalculate LC_ALL */
save_to_buffer(calculate_LC_ALL(PL_curlocales), &PL_curlocales[LC_ALL_INDEX_], &PL_curlocales_sizes[LC_ALL_INDEX_]);
Safefree(PL_curlocales[LC_ALL_INDEX_]);
PL_curlocales[LC_ALL_INDEX_] =
savepv(calculate_LC_ALL(PL_curlocales));
}

return PL_curlocales[index];
Expand Down Expand Up @@ -993,6 +997,8 @@ S_setlocale_from_aggregate_LC_ALL(pTHX_ const char * locale, const line_t line)
* as the value may omit categories whose locale is 'C'. khw thinks it's
* better to store a complete LC_ALL. So calculate it. */
retval = savepv(calculate_LC_ALL(PL_curlocales));
Safefree(PL_curlocales[LC_ALL_INDEX_]);
PL_curlocales[LC_ALL_INDEX_] = retval;

Safefree(locale_on_entry);
return retval;
Expand Down Expand Up @@ -5268,8 +5274,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)

/* Similarly, in this case we need to fill in our records. */
for (i = 0; i < NOMINAL_LC_ALL_INDEX; i++) {
PL_curlocales_sizes[i] = 0;
save_to_buffer(curlocales[i], &PL_curlocales[i], &PL_curlocales_sizes[i]);
PL_curlocales[i] = savepv(curlocales[i]);
}

# endif
Expand Down
1 change: 0 additions & 1 deletion sv.c
Expand Up @@ -15648,7 +15648,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
#ifdef USE_PL_CURLOCALES
for (i = 0; i < (int) C_ARRAY_LENGTH(PL_curlocales); i++) {
PL_curlocales[i] = SAVEPV(proto_perl->Icurlocales[i]);
PL_curlocales_sizes[i] = strlen(PL_curlocales[i]);
}
#endif
#ifdef USE_LOCALE_CTYPE
Expand Down

0 comments on commit 12734a6

Please sign in to comment.