# HG changeset patch # User Matti Hamalainen # Date 1400355567 -10800 # Node ID d3d3cd41a95a03dd5e59c8df6c22005ed19dc5e6 # Parent b6f3486c4d6c2f8406bb76ad72962113e3187c23 Slight adjustments. diff -r b6f3486c4d6c -r d3d3cd41a95a th_string.c --- a/th_string.c Sat May 17 22:39:06 2014 +0300 +++ b/th_string.c Sat May 17 22:39:27 2014 +0300 @@ -53,8 +53,10 @@ */ char *th_strdup_vprintf(const char *fmt, va_list args) { - int size = 64; + int size = strlen(fmt); char *buf; + if (size < 64) + size = 64; if ((buf = th_malloc(size)) == NULL) return NULL; @@ -114,6 +116,7 @@ *buf = tmp; } + /* Compare two strings ignoring case [strcasecmp, strncasecmp] */ int th_strcasecmp(const char *str1, const char *str2) @@ -131,7 +134,7 @@ s2++; } - return (th_tolower(*s1) - th_tolower(*s2)); + return th_tolower(*s1) - th_tolower(*s2); }