diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-11-02 12:14:51 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-11-02 12:45:20 +0100 |
commit | d10b132bf5393e648a1c64569746c8e886d50702 (patch) | |
tree | 66a444574feee728a133c754c9527c02fe25e249 /stdio-common/tstdiomisc.c | |
parent | c94a5688fb1228a862b2d4a3f1239cdc0e3349e5 (diff) | |
download | glibc-d10b132bf5393e648a1c64569746c8e886d50702.tar.gz |
stdio-common: Use array_length and array_end macros
Diffstat (limited to 'stdio-common/tstdiomisc.c')
-rw-r--r-- | stdio-common/tstdiomisc.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c index 89009e0549..c2fc73deb1 100644 --- a/stdio-common/tstdiomisc.c +++ b/stdio-common/tstdiomisc.c @@ -1,3 +1,4 @@ +#include <array_length.h> #include <float.h> #include <math.h> #include <stdio.h> @@ -66,8 +67,7 @@ t3 (void) retval = sprintf (buf, "%p", (char *) NULL); result |= retval != 5 || strcmp (buf, "(nil)") != 0; - retval = swprintf (wbuf, sizeof (wbuf) / sizeof (wbuf[0]), - L"%p", (char *) NULL); + retval = swprintf (wbuf, array_length (wbuf), L"%p", (char *) NULL); result |= retval != 5 || wcscmp (wbuf, L"(nil)") != 0; return result; @@ -142,38 +142,38 @@ F (void) printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n", buf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G", + swprintf (wbuf, array_length (wbuf), L"%a %A %e %E %f %F %g %G", qnanval, qnanval, qnanval, qnanval, qnanval, qnanval, qnanval, qnanval); result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0; printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G", + swprintf (wbuf, array_length (wbuf), L"%a %A %e %E %f %F %g %G", -qnanval, -qnanval, -qnanval, -qnanval, -qnanval, -qnanval, -qnanval, -qnanval); result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0; printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G", + swprintf (wbuf, array_length (wbuf), L"%a %A %e %E %f %F %g %G", snanval, snanval, snanval, snanval, snanval, snanval, snanval, snanval); result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0; printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G", + swprintf (wbuf, array_length (wbuf), L"%a %A %e %E %f %F %g %G", msnanval, msnanval, msnanval, msnanval, msnanval, msnanval, msnanval, msnanval); result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0; printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G", + swprintf (wbuf, array_length (wbuf), L"%a %A %e %E %f %F %g %G", infval, infval, infval, infval, infval, infval, infval, infval); result |= wcscmp (wbuf, L"inf INF inf INF inf INF inf INF") != 0; printf ("expected L\"inf INF inf INF inf INF inf INF\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G", + swprintf (wbuf, array_length (wbuf), L"%a %A %e %E %f %F %g %G", -infval, -infval, -infval, -infval, -infval, -infval, -infval, -infval); result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0; @@ -223,14 +223,14 @@ F (void) printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n", buf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), + swprintf (wbuf, array_length (wbuf), L"%La %LA %Le %LE %Lf %LF %Lg %LG", lqnanval, lqnanval, lqnanval, lqnanval, lqnanval, lqnanval, lqnanval, lqnanval); result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0; printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), + swprintf (wbuf, array_length (wbuf), L"%La %LA %Le %LE %Lf %LF %Lg %LG", -lqnanval, -lqnanval, -lqnanval, -lqnanval, -lqnanval, -lqnanval, -lqnanval, -lqnanval); @@ -238,14 +238,14 @@ F (void) printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), + swprintf (wbuf, array_length (wbuf), L"%La %LA %Le %LE %Lf %LF %Lg %LG", lsnanval, lsnanval, lsnanval, lsnanval, lsnanval, lsnanval, lsnanval, lsnanval); result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0; printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), + swprintf (wbuf, array_length (wbuf), L"%La %LA %Le %LE %Lf %LF %Lg %LG", lmsnanval, lmsnanval, lmsnanval, lmsnanval, lmsnanval, lmsnanval, lmsnanval, lmsnanval); @@ -253,14 +253,14 @@ F (void) printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), + swprintf (wbuf, array_length (wbuf), L"%La %LA %Le %LE %Lf %LF %Lg %LG", linfval, linfval, linfval, linfval, linfval, linfval, linfval, linfval); result |= wcscmp (wbuf, L"inf INF inf INF inf INF inf INF") != 0; printf ("expected L\"inf INF inf INF inf INF inf INF\", got L\"%S\"\n", wbuf); - swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), + swprintf (wbuf, array_length (wbuf), L"%La %LA %Le %LE %Lf %LF %Lg %LG", -linfval, -linfval, -linfval, -linfval, -linfval, -linfval, -linfval, -linfval); |