summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-04-10 19:44:16 -0600
committerKarl Williamson <khw@cpan.org>2022-08-09 18:05:59 -0600
commit32899cfbfbeefbe5023d40fcf4ed4420752f9b20 (patch)
treeb72926a8973f9006f35dc2d1cc6b26c030951580 /perl.c
parent82e2ef274609fbe3e9e3a0c11bab9b6ef9b3d959 (diff)
downloadperl-32899cfbfbeefbe5023d40fcf4ed4420752f9b20.tar.gz
locale.c: Generalize stdize_locale()
This function is rewritten to handle LC_ALL, and to make it easier to add new checks. There is also a change, which I think is an improvement, in that everything starting with a \n is trimmed, instead of just a trailing \n. A couple of calls to stdize_locale() are removed, as they are redundant, because they are called only as a result of Perl_setlocale() being called, and that ends up calling stdize_locale always, early on. The call to savepv() is also moved in a couple cases to after the result is known to not be NULL I originally had such a new check in mind, but it turned out that doing it here didn't solve the problem, so this commit has been amended (before ever being pushed) to not include that. chomped.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 39f7f6bb57..1de61eeb5c 100644
--- a/perl.c
+++ b/perl.c
@@ -1149,6 +1149,11 @@ perl_destruct(pTHXx)
PL_langinfo_buf = NULL;
}
+ if (PL_stdize_locale_buf) {
+ Safefree(PL_stdize_locale_buf);
+ PL_stdize_locale_buf = NULL;
+ }
+
#ifdef USE_LOCALE_CTYPE
SvREFCNT_dec(PL_warn_locale);
PL_warn_locale = NULL;