summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-28 22:12:53 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-28 22:12:53 +0000
commitb38d83c41700ca440ba85e23127124afc39cf670 (patch)
tree85d0c57788d77225bcfceaab722433a357cf783d
parent79da739d645112dc7b9862061c38172dc31049a8 (diff)
downloadmpfr-b38d83c41700ca440ba85e23127124afc39cf670.tar.gz
[tests/tsprintf.c] Fixed setlocale usage (problem detected with MinGW
in the trunk) by not using the returned string any longer. Indeed, ISO C99 says that this string "may be overwritten by a subsequent call to the setlocale function". The tests in the 3.1 branch are different, so that this problem was not detected here on the tested platforms, including MinGW. (merged changeset r11533 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11540 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tsprintf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/tsprintf.c b/tests/tsprintf.c
index e9c1f1422..737ff86db 100644
--- a/tests/tsprintf.c
+++ b/tests/tsprintf.c
@@ -1273,13 +1273,12 @@ test20161214 (void)
int
main (int argc, char **argv)
{
- char *locale;
tests_start_mpfr ();
#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
/* currently, we just check with 'C' locale */
- locale = setlocale (LC_ALL, "C");
+ setlocale (LC_ALL, "C");
#endif
bug20111102 ();
@@ -1297,7 +1296,7 @@ main (int argc, char **argv)
locale_da_DK ();
/* Avoid a warning by doing the setlocale outside of this #if */
#endif
- setlocale (LC_ALL, locale);
+ setlocale (LC_ALL, "C");
#endif
if (getenv ("MPFR_CHECK_LIBC_PRINTF"))