]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - stdio-common/tst-swprintf.c
Improve documentation for malloc etc. (BZ#27719)
[thirdparty/glibc.git] / stdio-common / tst-swprintf.c
index e65234b1c2f243d34c4de4e78f6768f2863bda1c..07194eb67d672d580d2d8b0a9929df4a0539ade7 100644 (file)
@@ -1,3 +1,4 @@
+#include <array_length.h>
 #include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 const char input[] = "\x8e\xa1g\x8e\xa2h\x8e\xa3i\x8e\xa4j";
 
-int
-main (void)
+static int
+do_test (void)
 {
   wchar_t buf[1000];
-#define nbuf (sizeof (buf) / sizeof (buf[0]))
   int result = 0;
   ssize_t n;
 
@@ -27,7 +27,7 @@ main (void)
     }
 
 #define CHECK(fmt, nexp, exp) \
-  n = swprintf (buf, nbuf, fmt, input);                                              \
+  n = swprintf (buf, array_length (buf), fmt, input);                        \
   if (n != nexp)                                                             \
     {                                                                        \
       printf ("swprintf (.., .., L\"%ls\", \"%ls\") return %d, not %d\n",     \
@@ -54,3 +54,6 @@ swprintf (.., .., L\"%ls\", \"%ls\") produced \"%ls\", not \"%ls\"\n",              \
 
   return result;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"