comparison libpurple/util.c @ 31905:323876c34a96

Don't use strlen() when all you're trying to do is check if the string is empty
author Mark Doliner <mark@kingant.net>
date Mon, 22 Aug 2011 02:07:41 +0000
parents 7df08e88d9bb
children 99ca503ea087
comparison
equal deleted inserted replaced
31904:3322201b446f 31905:323876c34a96
145 145
146 g_return_val_if_fail(str != NULL, NULL); 146 g_return_val_if_fail(str != NULL, NULL);
147 147
148 len = strlen(str); 148 len = strlen(str);
149 149
150 g_return_val_if_fail(strlen(str) > 0, 0); 150 g_return_val_if_fail(*str, 0);
151 g_return_val_if_fail(len % 2 == 0, 0); 151 g_return_val_if_fail(len % 2 == 0, 0);
152 152
153 data = g_malloc(len / 2); 153 data = g_malloc(len / 2);
154 154
155 for (i = 0; i < len; i++) 155 for (i = 0; i < len; i++)
2265 char *d; 2265 char *d;
2266 2266
2267 url_buf = g_string_free(gurl_buf, FALSE); 2267 url_buf = g_string_free(gurl_buf, FALSE);
2268 2268
2269 /* strip off trailing periods */ 2269 /* strip off trailing periods */
2270 if (strlen(url_buf) > 0) { 2270 if (*url_buf) {
2271 for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--) 2271 for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--)
2272 *d = '\0'; 2272 *d = '\0';
2273 } 2273 }
2274 2274
2275 tmpurlbuf = purple_unescape_html(url_buf); 2275 tmpurlbuf = purple_unescape_html(url_buf);