This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Use macro instead of its expansion
authorKarl Williamson <khw@cpan.org>
Wed, 17 Jan 2018 15:27:04 +0000 (08:27 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 31 Jan 2018 05:49:03 +0000 (22:49 -0700)
This macro in a future commit will become more complex.

locale.c

index d4f90e7..336e752 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -1452,14 +1452,18 @@ S_my_nl_langinfo(const int item, bool toggle)
 
     LOCALE_LOCK;
 
+    {
+        DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
+
     if (toggle) {
-            do_setlocale_c(LC_NUMERIC, PL_numeric_name);
+            STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();
     }
 
     save_to_buffer(nl_langinfo(item), &PL_langinfo_buf, &PL_langinfo_bufsize, 0);
 
     if (toggle) {
-        do_setlocale_c(LC_NUMERIC, "C");
+            RESTORE_LC_NUMERIC();
+    }
     }
 
     LOCALE_UNLOCK;
@@ -1507,6 +1511,7 @@ S_my_nl_langinfo(const int item, bool toggle)
 #  ifdef HAS_LOCALECONV
 
         const struct lconv* lc;
+        DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
 
 #  endif
 #  ifdef HAS_STRFTIME
@@ -1585,7 +1590,7 @@ S_my_nl_langinfo(const int item, bool toggle)
                 LOCALE_LOCK;
 
                 if (toggle) {
-                        do_setlocale_c(LC_NUMERIC, PL_numeric_name);
+                    STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();
                 }
 
                 lc = localeconv();
@@ -1605,7 +1610,7 @@ S_my_nl_langinfo(const int item, bool toggle)
                                &PL_langinfo_bufsize, 0);
 
                 if (toggle) {
-                    do_setlocale_c(LC_NUMERIC, "C");
+                    RESTORE_LC_NUMERIC();
                 }
 
                 LOCALE_UNLOCK;