Mercurial > hg > nnchat
comparison th_string.c @ 282:3dc86d8eb0a9
Added helper functions for easier string manipulation.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 Jun 2011 20:48:17 +0300 |
parents | 517c7b22b3c9 |
children | eb74097b73f5 |
comparison
equal
deleted
inserted
replaced
281:8ae649a4b738 | 282:3dc86d8eb0a9 |
---|---|
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 { |