diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-22 15:28:36 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-09-22 15:28:36 +0000 |
commit | 753ceac3272a8c4f150ace8b4695991a85345c3c (patch) | |
tree | f9e62f7d544f634bc6e8b13b194f10182c980d91 /src/libstddjb/case_uppers.c | |
parent | aebe8604605b41803c43c1def87549569b821b27 (diff) | |
download | skalibs-753ceac3272a8c4f150ace8b4695991a85345c3c.tar.xz |
Revamp case functions, add strcasestr() fallback
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/case_uppers.c')
-rw-r--r-- | src/libstddjb/case_uppers.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstddjb/case_uppers.c b/src/libstddjb/case_uppers.c index da0837c..4191711 100644 --- a/src/libstddjb/case_uppers.c +++ b/src/libstddjb/case_uppers.c @@ -1,13 +1,14 @@ /* ISC license. */ +#include <ctype.h> + #include <skalibs/bytestr.h> void case_uppers (char *s) { - unsigned char const d = 'a' - 'A' ; while (*s) { - if (('a' <= *s) && (*s <= 'z')) *s -= d ; - ++s ; + int c = toupper(*s) ; + *s++ = (unsigned char)c ; } } |