summaryrefslogtreecommitdiff
path: root/tests/tprintf.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-07-04 12:20:43 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-07-04 12:20:43 +0000
commitcf923deeffde0b1262be9062274c35a6c6e2b63b (patch)
tree4e6b810a5169119a2b3e6787e9396fb78b241927 /tests/tprintf.c
parentbb55b7eb598b2ec3e83070802ea1a8b03a9f7ee9 (diff)
downloadmpfr-cf923deeffde0b1262be9062274c35a6c6e2b63b.tar.gz
[tests/tprintf.c] test_locale() cleanup.
* Conditional #include <locale.h> with the other header inclusions. * Completed a #if (to be like in tsprintf.c). * Moved a global variable as local to test_locale(). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12874 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tprintf.c')
-rw-r--r--tests/tprintf.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/tprintf.c b/tests/tprintf.c
index 6c5aa22ec..504ada49e 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -31,6 +31,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include <stddef.h>
#include <errno.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
#include "mpfr-intmax.h"
#include "mpfr-test.h"
#define STDOUT_FILENO 1
@@ -474,20 +478,17 @@ check_random (int nb_tests)
mpfr_clear (x);
}
-#ifdef HAVE_LOCALE_H
-
-#include <locale.h>
-
-const char * const tab_locale[] = {
- "en_US",
- "en_US.iso88591",
- "en_US.iso885915",
- "en_US.utf8"
-};
+#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
static void
test_locale (void)
{
+ const char * const tab_locale[] = {
+ "en_US",
+ "en_US.iso88591",
+ "en_US.iso885915",
+ "en_US.utf8"
+ };
int i;
char *s = NULL;
mpfr_t x;