Signed-off-by: Alejandro Colomar <[email protected]>
---
 lib/canonicalize.c                          | 2 +-
 lib/chdir-long.c                            | 3 +--
 lib/idcache.c                               | 4 ++--
 lib/strtok_r.c                              | 2 +-
 tests/test-hash.c                           | 2 +-
 tests/test-strerror_r.c                     | 2 +-
 tests/unigbrk/test-uc-grapheme-breaks.c     | 8 ++++----
 tests/unigbrk/test-uc-is-grapheme-break.c   | 8 ++++----
 tests/unilbrk/test-uc-possible-linebreaks.c | 8 ++++----
 tests/uniname/test-uninames.c               | 4 ++--
 tests/uniwbrk/test-uc-wordbreaks.c          | 8 ++++----
 11 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/lib/canonicalize.c b/lib/canonicalize.c
index 06a600315267..4bbbe2ad75d1 100644
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -433,7 +433,7 @@ canonicalize_filename_mode_stk (const char *name, 
canonicalize_mode_t can_mode,
                           : *end || file_accessible (rname))
                       || (can_exist == CAN_ALL_BUT_LAST
                           && errno == ENOENT
-                          && !end[strspn (end, SLASHES)])))
+                          && !*stpspn (end, SLASHES))))
             goto error;
         }
 
diff --git a/lib/chdir-long.c b/lib/chdir-long.c
index aa5791b9b281..081353e22f0e 100644
--- a/lib/chdir-long.c
+++ b/lib/chdir-long.c
@@ -86,8 +86,7 @@ cdb_advance_fd (struct cd_buf *cdb, char const *dir)
 static char * _GL_ATTRIBUTE_PURE
 find_non_slash (char const *s)
 {
-  size_t n_slash = strspn (s, "/");
-  return (char *) s + n_slash;
+  return stpspn (s, "/");
 }
 
 /* This is a function much like chdir, but without the PATH_MAX limitation
diff --git a/lib/idcache.c b/lib/idcache.c
index 5fd5f2cd9025..1b692bf68e52 100644
--- a/lib/idcache.c
+++ b/lib/idcache.c
@@ -117,7 +117,7 @@ getuidbyname (const char *user)
 #ifdef __DJGPP__
   /* We need to pretend to be the user USER, to make
      pwd functions know about an arbitrary user name.  */
-  if (!pwent && strspn (user, digits) < strlen (user))
+  if (!pwent && *stpspn (user, digits) != '\0')
     {
       setenv ("USER", user, 1);
       pwent = getpwnam (user);  /* now it will succeed */
@@ -196,7 +196,7 @@ getgidbyname (const char *group)
 #ifdef __DJGPP__
   /* We need to pretend to belong to group GROUP, to make
      grp functions know about an arbitrary group name.  */
-  if (!grent && strspn (group, digits) < strlen (group))
+  if (!grent && *stpspn (group, digits) != '\0')
     {
       setenv ("GROUP", group, 1);
       grent = getgrnam (group); /* now it will succeed */
diff --git a/lib/strtok_r.c b/lib/strtok_r.c
index 1bff67baa819..6dc47b8c461b 100644
--- a/lib/strtok_r.c
+++ b/lib/strtok_r.c
@@ -47,7 +47,7 @@ __strtok_r (char *s, const char *delim, char **save_ptr)
     s = *save_ptr;
 
   /* Scan leading delimiters.  */
-  s += strspn (s, delim);
+  s = stpspn (s, delim);
   if (*s == '\0')
     {
       *save_ptr = s;
diff --git a/tests/test-hash.c b/tests/test-hash.c
index ae1f415b8c38..e257c5d5330d 100644
--- a/tests/test-hash.c
+++ b/tests/test-hash.c
@@ -70,7 +70,7 @@ static int
 get_seed (char const *str, unsigned int *seed)
 {
   size_t len = strlen (str);
-  if (len == 0 || strspn (str, "0123456789") != len || 10 < len)
+  if (len == 0 || *stpspn (str, "0123456789") != '\0' || 10 < len)
     return 1;
 
   *seed = atoi (str);
diff --git a/tests/test-strerror_r.c b/tests/test-strerror_r.c
index 63a0623a7863..e96d2f8af1a9 100644
--- a/tests/test-strerror_r.c
+++ b/tests/test-strerror_r.c
@@ -115,7 +115,7 @@ main (void)
                 ASSERT (strncmp (buf, buf2, i - 1) == 0);
                 ASSERT (buf[i - 1] == '\0');
               }
-            ASSERT (strspn (buf + i, "^") == sizeof buf - 1 - i);
+            ASSERT (*stpspn (buf + i, "^") == '\0');
           }
 
         strcpy (buf, "BADFACE");
diff --git a/tests/unigbrk/test-uc-grapheme-breaks.c 
b/tests/unigbrk/test-uc-grapheme-breaks.c
index 3de349e7f1a8..5b461dc11102 100644
--- a/tests/unigbrk/test-uc-grapheme-breaks.c
+++ b/tests/unigbrk/test-uc-grapheme-breaks.c
@@ -124,7 +124,7 @@ main (int argc, char *argv[])
       if (comment != NULL)
         *comment = '\0';
       /* Is the remaining line blank?  */
-      if (line[strspn (line, " \t\r\n")] == '\0')
+      if (*stpspn (line, " \t\r\n") == '\0')
         continue;
 
       const char *p;
@@ -136,7 +136,7 @@ main (int argc, char *argv[])
       p = line;
       do
         {
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (!strncmp (p, "\303\267" /* ÷ */, 2))
             {
               breaks[i] = '#';
@@ -154,7 +154,7 @@ main (int argc, char *argv[])
               exit (1);
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (*p == '\0')
             s[i] = 0;
           else
@@ -173,7 +173,7 @@ main (int argc, char *argv[])
 
               s[i] = next_int;
             }
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           i++;
         }
       while (*p != '\0');
diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c 
b/tests/unigbrk/test-uc-is-grapheme-break.c
index 61b3a2bdec9d..0e9e50469e9f 100644
--- a/tests/unigbrk/test-uc-is-grapheme-break.c
+++ b/tests/unigbrk/test-uc-is-grapheme-break.c
@@ -91,7 +91,7 @@ main (int argc, char *argv[])
       if (comment != NULL)
         *comment = '\0';
       /* Is the remaining line blank?  */
-      if (line[strspn (line, " \t\r\n")] == '\0')
+      if (*stpspn (line, " \t\r\n") == '\0')
         continue;
 
       const char *p;
@@ -118,7 +118,7 @@ main (int argc, char *argv[])
           bool should_break;
           ucs4_t next;
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (!strncmp (p, "\303\267" /* ÷ */, 2))
             {
               should_break = true;
@@ -136,7 +136,7 @@ main (int argc, char *argv[])
               exit (1);
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (*p == '\0')
             next = 0;
           else
@@ -200,7 +200,7 @@ main (int argc, char *argv[])
               exit_code = 1;
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           prev = next;
 
           incb_consonant_extended_linker =
diff --git a/tests/unilbrk/test-uc-possible-linebreaks.c 
b/tests/unilbrk/test-uc-possible-linebreaks.c
index bf268286f29a..adb041c20fe9 100644
--- a/tests/unilbrk/test-uc-possible-linebreaks.c
+++ b/tests/unilbrk/test-uc-possible-linebreaks.c
@@ -61,7 +61,7 @@ main (int argc, char *argv[])
       if (comment != NULL)
         *comment = '\0';
       /* Is the remaining line blank?  */
-      if (line[strspn (line, " \t\r\n")] == '\0')
+      if (*stpspn (line, " \t\r\n") == '\0')
         continue;
 
       const char *p;
@@ -74,7 +74,7 @@ main (int argc, char *argv[])
       p = line;
       do
         {
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (!strncmp (p, "\303\267" /* ÷ */, 2))
             {
               breaks_expected[i] = 1;
@@ -92,7 +92,7 @@ main (int argc, char *argv[])
               exit (1);
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (*p != '\0')
             {
               unsigned int next_int;
@@ -110,7 +110,7 @@ main (int argc, char *argv[])
               input[i] = next_int;
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           i++;
         }
       while (*p != '\0');
diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c
index 38dc618c4abc..5c32d21ab680 100644
--- a/tests/uniname/test-uninames.c
+++ b/tests/uniname/test-uninames.c
@@ -70,7 +70,7 @@ fill_names (const char *unicodedata_filename)
       comment = strchr (line, '#');
       if (comment != NULL)
         *comment = '\0';
-      if (line[strspn (line, " \t\r\n")] == '\0')
+      if (*stpspn (line, " \t\r\n") == '\0')
         continue;
 
       field0 = p = line;
@@ -136,7 +136,7 @@ fill_aliases (const char *namealiases_filename)
       comment = strchr (line, '#');
       if (comment != NULL)
         *comment = '\0';
-      if (line[strspn (line, " \t\r\n")] == '\0')
+      if (*stpspn (line, " \t\r\n") == '\0')
         continue;
 
       lineno++;
diff --git a/tests/uniwbrk/test-uc-wordbreaks.c 
b/tests/uniwbrk/test-uc-wordbreaks.c
index a9dcb6289dfd..eb9ab3965c8f 100644
--- a/tests/uniwbrk/test-uc-wordbreaks.c
+++ b/tests/uniwbrk/test-uc-wordbreaks.c
@@ -97,7 +97,7 @@ main (int argc, char *argv[])
       if (comment != NULL)
         *comment = '\0';
       /* Is the remaining line blank?  */
-      if (line[strspn (line, " \t\r\n")] == '\0')
+      if (*stpspn (line, " \t\r\n") == '\0')
         continue;
 
       const char *p;
@@ -110,7 +110,7 @@ main (int argc, char *argv[])
       p = line;
       do
         {
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (!strncmp (p, "\303\267" /* ÷ */, 2))
             {
               breaks_expected[i] = 1;
@@ -128,7 +128,7 @@ main (int argc, char *argv[])
               exit (1);
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           if (*p != '\0')
             {
               unsigned int next_int;
@@ -146,7 +146,7 @@ main (int argc, char *argv[])
               input[i] = next_int;
             }
 
-          p += strspn (p, " \t\r\n");
+          p = stpspn (p, " \t\r\n");
           i++;
         }
       while (*p != '\0');
-- 
2.51.0


Reply via email to