From 1a413b72dbdcb8842134eaa335df743b375e12bd Mon Sep 17 00:00:00 2001
From: Andrew Bettison <andrew@servalproject.org>
Date: Wed, 23 Oct 2013 00:57:48 +1030
Subject: [PATCH] Add str_tolower_inplace() function

---
 str.c | 8 ++++++++
 str.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/str.c b/str.c
index 7ce43f82..182a7842 100644
--- a/str.c
+++ b/str.c
@@ -123,6 +123,14 @@ char *str_toupper_inplace(char *str)
   return str;
 }
 
+char *str_tolower_inplace(char *str)
+{
+  register char *s;
+  for (s = str; *s; ++s)
+    *s = tolower(*s);
+  return str;
+}
+
 const char *strnchr(const char *s, size_t n, char c)
 {
   for (; n; --n, ++s) {
diff --git a/str.h b/str.h
index d14b7f47..a02645ce 100644
--- a/str.h
+++ b/str.h
@@ -92,7 +92,9 @@ __STR_INLINE int hexvalue(char c)
 }
 
 int is_all_matching(const unsigned char *ptr, size_t len, unsigned char value);
+
 char *str_toupper_inplace(char *s);
+char *str_tolower_inplace(char *s);
 
 char *toprint(char *dstStr, ssize_t dstBufSiz, const char *srcBuf, size_t srcBytes, const char quotes[2]);
 char *toprint_str(char *dstStr, ssize_t dstBufSiz, const char *srcStr, const char quotes[2]);