From 1d80cc9acf21080119a9c2704ca2a15aa09d1659 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 10 Mar 2003 15:23:44 +0000 Subject: 18330: save output of setlocale as the pointer it returns gets clobbered --- Src/math.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Src/math.c') diff --git a/Src/math.c b/Src/math.c index bc0669b7e..dc75a8143 100644 --- a/Src/math.c +++ b/Src/math.c @@ -399,12 +399,12 @@ zzlex(void) /* it's a float */ yyval.type = MN_FLOAT; #ifdef USE_LOCALE - prev_locale = setlocale(LC_NUMERIC, NULL); + prev_locale = dupstring(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "POSIX"); #endif yyval.u.d = strtod(ptr, &nptr); #ifdef USE_LOCALE - setlocale(LC_NUMERIC, prev_locale); + if (prev_locale) setlocale(LC_NUMERIC, prev_locale); #endif if (ptr == nptr || *nptr == '.') { zerr("bad floating point constant", NULL, 0); -- cgit 1.4.1