From: Alejandro Colomar Date: Sat, 15 Feb 2025 21:06:30 +0000 (+0100) Subject: lib/string/: Add comments expanding the letter-soup API names X-Git-Tag: 4.17.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cba5e2e1c940bf15c1eccfff3cbcf1fb59526b8;p=thirdparty%2Fshadow.git lib/string/: Add comments expanding the letter-soup API names Suggested-by: Serge Hallyn Cc: Chris Bazley Signed-off-by: Alejandro Colomar --- diff --git a/lib/string/strchr/strchrcnt.h b/lib/string/strchr/strchrcnt.h index 1a1923eac..ba76bbdf0 100644 --- a/lib/string/strchr/strchrcnt.h +++ b/lib/string/strchr/strchrcnt.h @@ -18,6 +18,7 @@ ATTR_STRING(1) inline size_t strchrcnt(const char *s, char c); +// string character count inline size_t strchrcnt(const char *s, char c) { diff --git a/lib/string/strchr/strchrscnt.h b/lib/string/strchr/strchrscnt.h index 3d423bd29..2d8b25c75 100644 --- a/lib/string/strchr/strchrscnt.h +++ b/lib/string/strchr/strchrscnt.h @@ -20,6 +20,7 @@ ATTR_STRING(2) inline size_t strchrscnt(const char *s, const char *c); +// string characters count // Similar to strchrcnt(), but search for multiple characters. inline size_t strchrscnt(const char *s, const char *c) diff --git a/lib/string/strchr/strnul.h b/lib/string/strchr/strnul.h index 5754ad055..a55c892ac 100644 --- a/lib/string/strchr/strnul.h +++ b/lib/string/strchr/strnul.h @@ -13,6 +13,7 @@ #include "attr.h" +// string null-byte // Similar to strlen(3), but return a pointer instead of an offset. #define strnul(s) \ ({ \ diff --git a/lib/string/strcmp/strcaseeq.h b/lib/string/strcmp/strcaseeq.h index e93b47702..248903d94 100644 --- a/lib/string/strcmp/strcaseeq.h +++ b/lib/string/strcmp/strcaseeq.h @@ -18,6 +18,7 @@ ATTR_STRING(1) ATTR_STRING(2) inline bool strcaseeq(const char *s1, const char *s2); +// strings case-insensitive equal // streq(), but case-insensitive. inline bool strcaseeq(const char *s1, const char *s2) diff --git a/lib/string/strcmp/streq.h b/lib/string/strcmp/streq.h index 267045c5c..2c7c8392f 100644 --- a/lib/string/strcmp/streq.h +++ b/lib/string/strcmp/streq.h @@ -19,6 +19,7 @@ ATTR_STRING(2) inline bool streq(const char *s1, const char *s2); +// strings equal /* Return true if s1 and s2 compare equal. */ inline bool streq(const char *s1, const char *s2) diff --git a/lib/string/strftime.h b/lib/string/strftime.h index 578e5f67d..2c86e89d1 100644 --- a/lib/string/strftime.h +++ b/lib/string/strftime.h @@ -13,6 +13,7 @@ #include "sizeof.h" +// string format time #define STRFTIME(dst, fmt, tm) strftime(dst, NITEMS(dst), fmt, tm) diff --git a/lib/string/strspn/stprcspn.h b/lib/string/strspn/stprcspn.h index cdd84617c..9be7b7fa5 100644 --- a/lib/string/strspn/stprcspn.h +++ b/lib/string/strspn/stprcspn.h @@ -13,6 +13,7 @@ #include "string/strspn/strrcspn.h" +// string returns-pointer rear complement substring prefix length #define stprcspn(s, reject) \ ({ \ __auto_type s_ = (s); \ diff --git a/lib/string/strspn/stprspn.h b/lib/string/strspn/stprspn.h index 0cdce632f..a8a5ef36d 100644 --- a/lib/string/strspn/stprspn.h +++ b/lib/string/strspn/stprspn.h @@ -13,6 +13,7 @@ #include "string/strspn/strrspn.h" +// string returns-pointer rear substring prefix length // Available in Oracle Solaris as strrspn(3GEN). // #define stprspn(s, accept) \ diff --git a/lib/string/strspn/stpspn.h b/lib/string/strspn/stpspn.h index d213cd9ff..08a10f73f 100644 --- a/lib/string/strspn/stpspn.h +++ b/lib/string/strspn/stpspn.h @@ -13,6 +13,7 @@ #include "attr.h" +// string returns-pointer substring prefix length // Similar to strspn(3), but return a pointer instead of an offset. // Similar to strchrnul(3), but search for any bytes not in 'accept'. #define stpspn(s, accept) \ diff --git a/lib/string/strspn/strrcspn.h b/lib/string/strspn/strrcspn.h index c91453c4d..1510041eb 100644 --- a/lib/string/strspn/strrcspn.h +++ b/lib/string/strspn/strrcspn.h @@ -20,6 +20,7 @@ ATTR_STRING(2) inline size_t strrcspn(const char *s, const char *reject); +// string rear complement substring prefix length inline size_t strrcspn(const char *s, const char *reject) { diff --git a/lib/string/strspn/strrspn.h b/lib/string/strspn/strrspn.h index ea703ff44..6e2e6bfab 100644 --- a/lib/string/strspn/strrspn.h +++ b/lib/string/strspn/strrspn.h @@ -20,6 +20,7 @@ ATTR_STRING(2) inline size_t strrspn_(const char *s, const char *accept); +// string rear substring prefix length inline size_t strrspn_(const char *s, const char *accept) { diff --git a/lib/string/strtok/stpsep.h b/lib/string/strtok/stpsep.h index f084bc461..782b11fd4 100644 --- a/lib/string/strtok/stpsep.h +++ b/lib/string/strtok/stpsep.h @@ -17,6 +17,7 @@ ATTR_STRING(1) ATTR_STRING(2) inline char *stpsep(char *s, const char *delim); +// string returns-pointer separate // Similar to strsep(3), // but return the next token, and don't update the input pointer. // Similar to strtok(3),