Skip to content

Commit e93b912

Browse files
committed
tools/nolibc/string: remove open-coded strnlen()
The same header already defines an implementation of strnlen(), so use it. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
1 parent 1063649 commit e93b912

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

tools/include/nolibc/string.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,7 @@ char *strndup(const char *str, size_t maxlen)
187187
static __attribute__((unused))
188188
size_t strlcat(char *dst, const char *src, size_t size)
189189
{
190-
size_t len = 0;
191-
192-
for (; len < size; len++) {
193-
if (dst[len] == '\0')
194-
break;
195-
}
190+
size_t len = strnlen(dst, size);
196191

197192
/*
198193
* We want len < size-1. But as size is unsigned and can wrap

0 commit comments

Comments
 (0)