Mercurial > hg > th-libs
changeset 88:d3d3cd41a95a
Slight adjustments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 17 May 2014 22:39:27 +0300 |
parents | b6f3486c4d6c |
children | 30690f5c4cae |
files | th_string.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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); }