summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2024-08-08 17:20:05 +0800
committerYu-Ping Wu <yupingso@google.com>2024-08-14 03:09:03 +0000
commit0dcdc0347c8d0405c1c6b444d23483dd9bf31d34 (patch)
treed5a585c35646db88b97be81a25ce756dfe5e759b /payloads/libpayload/include
parent4ea4d82cec7ca3e66a10b2cd5bffe82d6854ff5d (diff)
commonlib/bsd: Add strlen() and strnlen() functions
Add strlen() and strnlen() to commonlib/bsd by rewriting them from scratch, and remove the same functions from coreboot and libpayload. Note that in the existing libpayload implementation, these functions return 0 for NULL strings. Given that POSIX doesn't require the NULL check and that other major libc implementations (e.g. glibc [1]) don't seem to do that, the new functions also don't perform the NULL check. [1] https://github.com/bminor/glibc/blob/master/sysdeps/i386/strlen.c Change-Id: I1203ec9affabe493bd14b46662d212b08240cced Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83830 Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/string.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/payloads/libpayload/include/string.h b/payloads/libpayload/include/string.h
index f4ce41fce7..7762c36b67 100644
--- a/payloads/libpayload/include/string.h
+++ b/payloads/libpayload/include/string.h
@@ -47,8 +47,6 @@ int memcmp(const void *s1, const void *s2, size_t len);
* @defgroup string String functions
* @{
*/
-size_t strnlen(const char *str, size_t maxlen);
-size_t strlen(const char *str);
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t maxlen);
int strcasecmp(const char *s1, const char *s2);