projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1063649
)
tools/nolibc/string: remove open-coded strnlen()
author
Thomas Weißschuh
<linux@weissschuh.net>
Wed, 10 Apr 2024 21:27:06 +0000
(23:27 +0200)
committer
Thomas Weißschuh
<linux@weissschuh.net>
Wed, 10 Apr 2024 21:27:06 +0000
(23:27 +0200)
The same header already defines an implementation of strnlen(),
so use it.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/string.h
patch
|
blob
|
history
diff --git
a/tools/include/nolibc/string.h
b/tools/include/nolibc/string.h
index 565230a4ad4724dab41dd61bdb65850f9c6ca3ee..f9ab28421e6dcd8a1d9ef10475dad07da45e3da1 100644
(file)
--- 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