From e93b912ecf6ab113c9d4ec9ced2fa30dfac24c70 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Wed, 10 Apr 2024 23:27:06 +0200 Subject: tools/nolibc/string: remove open-coded strnlen() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same header already defines an implementation of strnlen(), so use it. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/string.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h index 565230a4ad47..f9ab28421e6d 100644 --- a/tools/include/nolibc/string.h +++ b/tools/include/nolibc/string.h @@ -187,12 +187,7 @@ char *strndup(const char *str, size_t maxlen) static __attribute__((unused)) size_t strlcat(char *dst, const char *src, size_t size) { - size_t len = 0; - - for (; len < size; len++) { - if (dst[len] == '\0') - break; - } + size_t len = strnlen(dst, size); /* * We want len < size-1. But as size is unsigned and can wrap -- cgit v1.2.3