summaryrefslogtreecommitdiff
path: root/src/libstddjb/case_lowerb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/case_lowerb.c')
-rw-r--r--src/libstddjb/case_lowerb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstddjb/case_lowerb.c b/src/libstddjb/case_lowerb.c
index 66284df..7cc5331 100644
--- a/src/libstddjb/case_lowerb.c
+++ b/src/libstddjb/case_lowerb.c
@@ -1,13 +1,14 @@
/* ISC license. */
+#include <ctype.h>
+
#include <skalibs/bytestr.h>
void case_lowerb (char *s, size_t len)
{
- unsigned char const d = 'a' - 'A' ;
while (len--)
{
- if (('A' <= *s) && (*s <= 'Z')) *s += d ;
- ++s ;
+ int c = tolower(*s) ;
+ *s++ = (unsigned char)c ;
}
}