This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Rmv spurious Safefree
[perl5.git] / locale.c
index 809b6b9..a86a028 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -964,7 +964,6 @@ S_emulate_setlocale(const int category,
                 if (category == LC_ALL) {
                     char * individ_locale = Perl_form(aTHX_ "%.*s", (int) (p - s), s);
                     emulate_setlocale(categories[i], individ_locale, i, TRUE);
-                    Safefree(individ_locale);
                 }
             }
 
@@ -998,7 +997,6 @@ S_emulate_setlocale(const int category,
 #  endif
 
         if (! uselocale(old_obj)) {
-            SAVE_ERRNO;
 
 #  ifdef DEBUGGING
 
@@ -1656,10 +1654,9 @@ S_new_ctype(pTHX_ const char *newctype)
             if (UNLIKELY(bad_count) && PL_in_utf8_CTYPE_locale) {
                 PL_warn_locale = Perl_newSVpvf(aTHX_
                      "Locale '%s' contains (at least) the following characters"
-                     " which have\nnon-standard meanings: %s\nThe Perl program"
-                     " will use the standard meanings",
+                     " which have\nunexpected meanings: %s\nThe Perl program"
+                     " will use the expected meanings",
                       newctype, bad_chars_list);
-
             }
             else {
                 PL_warn_locale = Perl_newSVpvf(aTHX_
@@ -2274,7 +2271,7 @@ rather than getting segfaults at runtime.
 
 =item *
 
-It delivers the correct results for the C<RADIXCHAR> and C<THOUSESEP> items,
+It delivers the correct results for the C<RADIXCHAR> and C<THOUSEP> items,
 without you having to write extra code.  The reason for the extra code would be
 because these are from the C<LC_NUMERIC> locale category, which is normally
 kept set to the C locale by Perl, no matter what the underlying locale is
@@ -2581,13 +2578,13 @@ S_my_nl_langinfo(const int item, bool toggle)
                 { /*  khw couldn't figure out how the localedef specifications
                       would show that the $ should replace the radix; this is
                       just a guess as to how it might work.*/
-                    retval = ".";
+                    PL_langinfo_buf[0] = '.';
                 }
                 else if (lc->p_cs_precedes) {
-                    retval = "-";
+                    PL_langinfo_buf[0] = '-';
                 }
                 else {
-                    retval = "+";
+                    PL_langinfo_buf[0] = '+';
                 }
 
                 LOCALE_UNLOCK;
@@ -2850,13 +2847,14 @@ S_my_nl_langinfo(const int item, bool toggle)
 
                 LOCALE_UNLOCK;
 
+                retval = PL_langinfo_buf;
+
                 /* If to return the format, not the value, overwrite the buffer
                  * with it.  But some strftime()s will keep the original format
                  * if illegal, so change those to "" */
                 if (return_format) {
                     if (strEQ(PL_langinfo_buf, format)) {
                         *PL_langinfo_buf = '\0';
-                        retval = PL_langinfo_buf;
                     }
                     else {
                         retval = save_to_buffer(format, &PL_langinfo_buf,