From: Alejandro Colomar Date: Thu, 19 Feb 2026 01:01:09 +0000 (+0100) Subject: lib/string/strchr/: strnul(): Simplify implementation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea80db6e1591708ea2964c4f63fadf0f95c623fe;p=thirdparty%2Fshadow.git lib/string/strchr/: strnul(): Simplify implementation This avoids an __auto_type local variable, and a GNU statement expression. Reviewed-by: Kees Cook Signed-off-by: Alejandro Colomar --- diff --git a/lib/string/strchr/strnul.h b/lib/string/strchr/strnul.h index 4cb3b2ca6..f03d36e9f 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