1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-04-28 06:33:36 +00:00

tests: Use strnul.

* tests/test-dfa-match-aux.c (main): Use strnul.
* tests/test-pthread-rwlock-waitqueue.c (reader_func, writer_func):
Likewise.
* tests/test-strtold.h (test_function): Likewise.
* tests/test-xstrtold.c (main): Likewise.
* modules/dfa-tests (Depends-on): Add strnul.
* modules/pthread-rwlock-extra-tests (Depends-on): Likewise.
* modules/c-strtold-tests (Depends-on): Likewise.
* modules/strtold-tests (Depends-on): Likewise.
* modules/xstrtold-tests (Depends-on): Likewise.
This commit is contained in:
Bruno Haible
2026-03-01 14:44:32 +01:00
parent f45f79845c
commit 8947cd3972
10 changed files with 26 additions and 7 deletions

View File

@@ -1,3 +1,17 @@
2026-03-01 Bruno Haible <bruno@clisp.org>
tests: Use strnul.
* tests/test-dfa-match-aux.c (main): Use strnul.
* tests/test-pthread-rwlock-waitqueue.c (reader_func, writer_func):
Likewise.
* tests/test-strtold.h (test_function): Likewise.
* tests/test-xstrtold.c (main): Likewise.
* modules/dfa-tests (Depends-on): Add strnul.
* modules/pthread-rwlock-extra-tests (Depends-on): Likewise.
* modules/c-strtold-tests (Depends-on): Likewise.
* modules/strtold-tests (Depends-on): Likewise.
* modules/xstrtold-tests (Depends-on): Likewise.
2026-03-01 Bruno Haible <bruno@clisp.org>
tests: Use memeq, part 3.

View File

@@ -18,6 +18,7 @@ setlocale
thread
nanosleep
strtold
strnul
configure.ac:
gt_LOCALE_FR

View File

@@ -13,6 +13,7 @@ unistd-h
regex
setlocale
test-framework-sh
strnul
configure.ac:

View File

@@ -10,6 +10,7 @@ extensions
pthread-thread
nanosleep
bool
strnul
configure.ac:

View File

@@ -14,6 +14,7 @@ float-h
isnanl-nolibm
signbit-no-c++
setlocale
strnul
configure.ac:
gt_LOCALE_FR

View File

@@ -8,6 +8,7 @@ strtold
float-h
isnanl-nolibm
signbit-no-c++
strnul
configure.ac:

View File

@@ -67,7 +67,7 @@ main (int argc, char **argv)
dfacomp (argv[1], strlen (argv[1]), dfa, 0);
beg = argv[2];
end = argv[2] + strlen (argv[2]);
end = strnul (argv[2]);
allow_nl = argc > 3 && atoi (argv[3]);
p = dfaexec (dfa, beg, end, allow_nl, NULL, NULL);

View File

@@ -111,7 +111,7 @@ reader_func (void *arg)
abort ();
}
ASSERT (pthread_rwlock_wrlock (&sprintf_lock) == 0);
sprintf (l->result + strlen (l->result), " %s", l->name);
sprintf (strnul (l->result), " %s", l->name);
ASSERT (pthread_rwlock_unlock (&sprintf_lock) == 0);
if (l->wait_after > 0)
{
@@ -150,7 +150,7 @@ writer_func (void *arg)
abort ();
}
ASSERT (pthread_rwlock_wrlock (&sprintf_lock) == 0);
sprintf (l->result + strlen (l->result), " %s", l->name);
sprintf (strnul (l->result), " %s", l->name);
ASSERT (pthread_rwlock_unlock (&sprintf_lock) == 0);
if (l->wait_after > 0)
{

View File

@@ -525,7 +525,7 @@ test_function (long double (*my_strtold) (const char *, char **))
errno = 0;
result = my_strtold (input, &ptr);
ASSERT (0.0L < result && result <= LDBL_MIN);
ASSERT (ptr == input + strlen (input));
ASSERT (ptr == strnul (input));
#if !defined _MSC_VER
ASSERT (errno == ERANGE);
#endif
@@ -541,7 +541,7 @@ test_function (long double (*my_strtold) (const char *, char **))
errno = 0;
result = my_strtold (input, &ptr);
ASSERT (-LDBL_MIN <= result && result < 0.0L);
ASSERT (ptr == input + strlen (input));
ASSERT (ptr == strnul (input));
#if !defined _MSC_VER
ASSERT (errno == ERANGE);
#endif

View File

@@ -664,7 +664,7 @@ main ()
bool ok = xstrtold (input, &ptr, &result, strtold);
ASSERT (ok);
ASSERT (0.0L < result && result <= LDBL_MIN);
ASSERT (ptr == input + strlen (input));
ASSERT (ptr == strnul (input));
ASSERT (errno == 0);
}
{
@@ -678,7 +678,7 @@ main ()
bool ok = xstrtold (input, &ptr, &result, strtold);
ASSERT (ok);
ASSERT (-LDBL_MIN <= result && result < 0.0L);
ASSERT (ptr == input + strlen (input));
ASSERT (ptr == strnul (input));
ASSERT (errno == 0);
}