From a41e5f14071f79da07d4c0b03b17d3788e003945 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Wed, 26 Jun 2024 18:03:28 +0200 Subject: lib/string: change return types to match C standard The return type of strspn and strcspn is supposed to be a size_t and not a signed integer. TEST=Now the openSIL code can be built with the coreboot headers without needing to add '-Wno-builtin-declaration-mismatch' or '-Wno-incompatible-library-redeclaration' to the cflags. Before the build would error out with various 'mismatch in return type of built-in function' errors. Signed-off-by: Felix Held Change-Id: I0ff612e2eee4f556f5c572b02cbc600ca411ae20 Reviewed-on: https://review.coreboot.org/c/coreboot/+/83223 Reviewed-by: Marshall Dawson Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas Reviewed-by: Varshit Pandya Reviewed-by: Matt DeVillier --- src/lib/string.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/string.c') diff --git a/src/lib/string.c b/src/lib/string.c index 7553295a7d..b1996ff103 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -125,9 +125,9 @@ int strncmp(const char *s1, const char *s2, size_t maxlen) return 0; } -int strspn(const char *str, const char *spn) +size_t strspn(const char *str, const char *spn) { - int ret = 0; + size_t ret = 0; while (*str != 0) { const char *p; @@ -140,9 +140,9 @@ int strspn(const char *str, const char *spn) return ret; } -int strcspn(const char *str, const char *spn) +size_t strcspn(const char *str, const char *spn) { - int ret = 0; + size_t ret = 0; while (*str != 0) { const char *p; -- cgit v1.2.3