diff --git a/lib/string/strchr/strnul.h b/lib/string/strchr/strnul.h index 4cb3b2ca6a..f03d36e9fb 100644 --- a/lib/string/strchr/strnul.h +++ b/lib/string/strchr/strnul.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2026, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -10,17 +10,9 @@ #include -#include "attr.h" - -// string null-byte -// Similar to strlen(3), but return a pointer instead of an offset. -#define strnul(s) \ -({ \ - __auto_type s_ = s; \ - \ - s_ + strlen(s_); \ -}) +// strnul - string null-byte +#define strnul(s) strchr(s, '\0') #endif // include guard diff --git a/lib/string/strcmp/strcaseeq.c b/lib/string/strcmp/strcaseeq.c index e44f1166b3..045d2d452f 100644 --- a/lib/string/strcmp/strcaseeq.c +++ b/lib/string/strcmp/strcaseeq.c @@ -1,12 +1,7 @@ -// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2026, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause #include "config.h" -#include - #include "string/strcmp/strcaseeq.h" - - -extern inline bool strcaseeq(const char *s1, const char *s2); diff --git a/lib/string/strcmp/strcaseeq.h b/lib/string/strcmp/strcaseeq.h index 41a8d56300..ec0e3d0ada 100644 --- a/lib/string/strcmp/strcaseeq.h +++ b/lib/string/strcmp/strcaseeq.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2026, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -8,23 +8,11 @@ #include "config.h" -#include #include -#include "attr.h" - -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) -{ - return strcasecmp(s1, s2) == 0; -} +// strcaseeq - strings case-insensitive equal +#define strcaseeq(s1, s2) (!strcasecmp(s1, s2)) #endif // include guard diff --git a/lib/string/strcmp/streq.c b/lib/string/strcmp/streq.c index 030169addf..b46cc98a21 100644 --- a/lib/string/strcmp/streq.c +++ b/lib/string/strcmp/streq.c @@ -1,12 +1,7 @@ -// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2026, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause #include "config.h" -#include - #include "string/strcmp/streq.h" - - -extern inline bool streq(const char *s1, const char *s2); diff --git a/lib/string/strcmp/streq.h b/lib/string/strcmp/streq.h index fc0268cb03..e56ef1cf69 100644 --- a/lib/string/strcmp/streq.h +++ b/lib/string/strcmp/streq.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2026, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -8,24 +8,11 @@ #include "config.h" -#include #include -#include "attr.h" - -ATTR_STRING(1) -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) -{ - return strcmp(s1, s2) == 0; -} +// streq - strings equal +#define streq(s1, s2) (!strcmp(s1, s2)) #endif // include guard