]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
tests: Use strnul.
authorBruno Haible <bruno@clisp.org>
Sun, 1 Mar 2026 13:44:32 +0000 (14:44 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 1 Mar 2026 13:44:32 +0000 (14:44 +0100)
* 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.

ChangeLog
modules/c-strtold-tests
modules/dfa-tests
modules/pthread-rwlock-extra-tests
modules/strtold-tests
modules/xstrtold-tests
tests/test-dfa-match-aux.c
tests/test-pthread-rwlock-waitqueue.c
tests/test-strtold.h
tests/test-xstrtold.c

index f0112f08e19338924370d2bfc272ac4d076ab86d..d27f18986664da252e0b05984be950a7cd49ada2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index c8760b00f0174a2243ba9bdee4530d90669145e3..285fbf6a28619d265d15cf7c7da30884452ea39a 100644 (file)
@@ -18,6 +18,7 @@ setlocale
 thread
 nanosleep
 strtold
+strnul
 
 configure.ac:
 gt_LOCALE_FR
index 8ae462bda6c0c4e4cc04ded44e1570d801eecd45..b28040c76be06149d2dd566cecc937b496232599 100644 (file)
@@ -13,6 +13,7 @@ unistd-h
 regex
 setlocale
 test-framework-sh
+strnul
 
 configure.ac:
 
index 1fedd57f9e0cfb714b10cb0f81fc5d3785588cea..c829a199afbeaf481cbb9fe10484e97228011b31 100644 (file)
@@ -10,6 +10,7 @@ extensions
 pthread-thread
 nanosleep
 bool
+strnul
 
 configure.ac:
 
index 25bf5b7eaabb82e091ba11202ddce0ea2c2574fc..1105fb13f63420e471b61696d57adb5d70492d96 100644 (file)
@@ -14,6 +14,7 @@ float-h
 isnanl-nolibm
 signbit-no-c++
 setlocale
+strnul
 
 configure.ac:
 gt_LOCALE_FR
index a39d26f8e8024791c42c3b7d0f0a566cf8f2ed78..c961d4cb4a7e0d67ca02a54faa0ab5a415a20afa 100644 (file)
@@ -8,6 +8,7 @@ strtold
 float-h
 isnanl-nolibm
 signbit-no-c++
+strnul
 
 configure.ac:
 
index 1331c0ab339249ee6a4c801f8dda2780d1044319..918ccba132837a0ac3669cb1709564151b453656 100644 (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);
index a81103cb02eaa7e7958339385b008d235eaf2532..f4163c7c55ecd789387f6fed7b26cfad4c717120 100644 (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)
     {
index 240a4f57606316cbf3195dfab56533eb8f926b4d..5c8d88c8a4403baf69aaaba4819e9b88ba643ecb 100644 (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
index 182171843db367ff263b3d1990628c92695940a9..77cf67e43aea3982a01e3244dad11e06b112e5be 100644 (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);
   }