scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 117e2caee5ca7b1441e2e4c4135c2aaac7b5cc78
parent 0f61a6528784b5add0eef1d64ea16eb5adf689f9
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Sun,  4 Jan 2026 21:09:03 +0100

tests: Minor improvements

Diffstat:
Mtests/libc/execute/0042-mbsrtowcs.c | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/libc/execute/0042-mbsrtowcs.c b/tests/libc/execute/0042-mbsrtowcs.c @@ -60,8 +60,7 @@ tests_mbsrtowcs(void) puts("testing mbsrtowcs1"); for (tp = tests; tp < &tests[NELEM(tests)]; ++tp) { errno = 0; - if (tp->s != NULL) - s = strcpy(str, tp->s); + s = strcpy(str, tp->s); memset(wcs, -1, sizeof(wcs)); r = mbsrtowcs(tp->wcs, &s, tp->n, NULL); @@ -77,8 +76,7 @@ tests_mbsrtowcs(void) puts("testing mbsrtowcs2"); for (tp = tests; tp < &tests[NELEM(tests)]; ++tp) { errno = 0; - if (tp->s != NULL) - s = strcpy(str, tp->s); + s = strcpy(str, tp->s); memset(wcs, -1, sizeof(wcs)); memset(&st, 0, sizeof(st)); @@ -107,10 +105,8 @@ tests_mbstowcs(void) r = mbstowcs(tp->wcs, tp->s, tp->n); assert(tp->r == r); - if (tp->r >= 0) { - if (tp->wcs) - assert(!wcsncmp(tp->wcsexp, tp->wcs, tp->r)); - } + if (tp->r >= 0 && tp->wcs) + assert(!wcsncmp(tp->wcsexp, tp->wcs, tp->r)); } }