]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/string/ctype/strisascii.h: Compact definitions
authorAlejandro Colomar <alx@kernel.org>
Fri, 2 Jan 2026 20:40:57 +0000 (21:40 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 11 Jun 2026 07:33:53 +0000 (09:33 +0200)
By being closer together, I find them more readable.  The pattern and
the differences are easier to spot.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/string/ctype/strisascii.h

index 5ce5f6b0abfb608acf2353817d21d3010ae641fc..2f58f43ea59ab057c6dbff09b804101c0aed7b7d 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <alx@kernel.org>
 // SPDX-License-Identifier: BSD-3-Clause
 
 
 #include "string/strspn/stpspn.h"
 
 
-inline bool strisdigit(const char *s);
-inline bool strisprint(const char *s);
+inline bool strisdigit(const char *s); // strisdigit - string is [:digit:]
+inline bool strisprint(const char *s); // strisprint - string is [:print:]
 
 
-// strisdigit - string is [:digit:]
 inline bool
 strisdigit(const char *s)
 {
-       if (streq(s, ""))
-               return false;
-
-       return streq(stpspn(s, CTYPE_DIGIT_C), "");
+       return !streq(s, "") && streq(stpspn(s, CTYPE_DIGIT_C), "");
 }
-
-
-// strisprint - string is [:print:]
 inline bool
 strisprint(const char *s)
 {
-       if (streq(s, ""))
-               return false;
-
-       return streq(stpspn(s, CTYPE_PRINT_C), "");
+       return !streq(s, "") && streq(stpspn(s, CTYPE_PRINT_C), "");
 }