This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix Perl_langinfo() for non-nl_langinfo() systems
authorKarl Williamson <khw@cpan.org>
Sun, 25 Feb 2018 19:51:59 +0000 (12:51 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 25 Feb 2018 20:03:45 +0000 (13:03 -0700)
Commit 628ff75a4a7ac013dad43df7a53fcb55bf758ed7 caused the return value
to not be set for some paths through the function on platforms, like
Windows, that don't have nl_langinfo()

locale.c

index 809b6b9..4d3b248 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -2850,13 +2850,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,