Add ChangeLog entries for changes from 639c42d7ab7 to 91f9e616645
[privoxy.git] / miscutil.c
index 499579f..831f3c5 100644 (file)
@@ -242,7 +242,7 @@ void write_pid_file(const char *pid_file)
  *
  * Function    :  hash_string
  *
- * Description :  Take a string and compute a (hopefuly) unique numeric
+ * Description :  Take a string and compute a (hopefully) unique numeric
  *                integer value. This is useful to "switch" a string.
  *
  * Parameters  :
@@ -560,6 +560,43 @@ char *string_toupper(const char *string)
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  string_tolower
+ *
+ * Description :  Produce a copy of string with all convertible
+ *                characters converted to lowercase.
+ *
+ * Parameters  :
+ *          1  :  string = string to convert
+ *
+ * Returns     :  Lowercase copy of string if possible,
+ *                NULL on out-of-memory or if string was NULL.
+ *
+ *********************************************************************/
+char *string_tolower(const char *string)
+{
+   char *result, *p;
+   const char *q;
+
+   if (!string || ((result = (char *)zalloc(strlen(string) + 1)) == NULL))
+   {
+      return NULL;
+   }
+
+   q = string;
+   p = result;
+
+   while (*q != '\0')
+   {
+      *p++ = (char)privoxy_tolower(*q++);
+   }
+
+   return result;
+
+}
+
+
 /*********************************************************************
  *
  * Function    :  string_move
@@ -596,7 +633,7 @@ void string_move(char *dst, char *src)
  *          1  :  string = string to be duplicated
  *          2  :  len = number of bytes to duplicate
  *
- * Returns     :  pointer to copy, or NULL if failiure
+ * Returns     :  pointer to copy, or NULL if failure
  *
  *********************************************************************/
 char *bindup(const char *string, size_t len)