summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorChristian Kirsch <ck@held.mind.de>2000-08-09 19:05:17 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-16 13:03:53 +0000
commitf93f4e4670f12de7577ebaebeb5e31d4510ff4fe (patch)
tree10619fb7889a8bcdaed40144c803c17fa0fa25ec /perl.h
parenta65e9df7d11c78917193138b8249299b47efd8b4 (diff)
downloadperl-f93f4e4670f12de7577ebaebeb5e31d4510ff4fe.tar.gz
The numeric locale was reset to "C" by s?printf and never restored.
Subject: [ID 20000809.003] setlocale(LC_NUMERIC...) produces different results in 5.005 and 5.6 Message-Id: <20000809170517.A25389@held> No test since adding the failing example to locale.t does not fail -- probably because the locale settings are so thoroughly tweaked by that time. Running the example standalone does fail, though. UPDATE: test case added at change #7540. p4raw-link: @7540 (not found) p4raw-id: //depot/perl@6648
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/perl.h b/perl.h
index 1ab2d82769..e5fa9882e4 100644
--- a/perl.h
+++ b/perl.h
@@ -3096,8 +3096,20 @@ typedef struct am_table_short AMTS;
((PL_hints & HINT_LOCALE) && \
PL_numeric_radix && (c) == PL_numeric_radix)
-#define RESTORE_NUMERIC_LOCAL() if ((PL_hints & HINT_LOCALE) && PL_numeric_standard) SET_NUMERIC_LOCAL()
-#define RESTORE_NUMERIC_STANDARD() if ((PL_hints & HINT_LOCALE) && PL_numeric_local) SET_NUMERIC_STANDARD()
+#define STORE_NUMERIC_LOCAL_SET_STANDARD() \
+ bool was_local = (PL_hints & HINT_LOCALE) && PL_numeric_local; \
+ if (!was_local) SET_NUMERIC_STANDARD();
+
+#define STORE_NUMERIC_STANDARD_SET_LOCAL() \
+ bool was_standard = !(PL_hints & HINT_LOCALE) || PL_numeric_standard; \
+ if (!was_standard) SET_NUMERIC_LOCAL();
+
+#define RESTORE_NUMERIC_LOCAL() \
+ if (was_local) SET_NUMERIC_LOCAL();
+
+#define RESTORE_NUMERIC_STANDARD() \
+ if (was_standard) SET_NUMERIC_STANDARD();
+
#define Atof my_atof
#else /* !USE_LOCALE_NUMERIC */
@@ -3105,6 +3117,8 @@ typedef struct am_table_short AMTS;
#define SET_NUMERIC_STANDARD() /**/
#define SET_NUMERIC_LOCAL() /**/
#define IS_NUMERIC_RADIX(c) (0)
+#define STORE_NUMERIC_LOCAL_SET_STANDARD() /**/
+#define STORE_NUMERIC_STANDARD_SET_LOCAL() /**/
#define RESTORE_NUMERIC_LOCAL() /**/
#define RESTORE_NUMERIC_STANDARD() /**/
#define Atof Perl_atof