comparison th_string.c @ 30:10d2dc143e4b

Add helper functions th_pstr_vprintf() and th_pstr_printf().
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 05:04:39 +0300
parents 04cfdefc3253
children a3ad77382c64
comparison
equal deleted inserted replaced
29:04cfdefc3253 30:10d2dc143e4b
93 va_end(ap); 93 va_end(ap);
94 94
95 return res; 95 return res;
96 } 96 }
97 97
98
99 void th_pstr_vprintf(char **buf, const char *fmt, va_list ap)
100 {
101 char *tmp = th_strdup_vprintf(fmt, ap);
102 th_free(*buf);
103 *buf = tmp;
104 }
105
106
107 void th_pstr_printf(char **buf, const char *fmt, ...)
108 {
109 char *tmp;
110 va_list ap;
111
112 va_start(ap, fmt);
113 tmp = th_strdup_vprintf(fmt, ap);
114 va_end(ap);
115
116 th_free(*buf);
117 *buf = tmp;
118 }
98 119
99 /* Compare two strings ignoring case [strcasecmp, strncasecmp] 120 /* Compare two strings ignoring case [strcasecmp, strncasecmp]
100 */ 121 */
101 int th_strcasecmp(const char * str1, const char * str2) 122 int th_strcasecmp(const char * str1, const char * str2)
102 { 123 {