Mercurial > pidgin.yaz
diff src/util.c @ 9777:8d891252f2ac
[gaim-migrate @ 10645]
URLs containing ' will open correctly. There was some over-zealous
double-quotation mark usage in gtknotify.c. That may have been my fault.
Also escape the URLs in debug and gaim_notify messages.
Also refactored gaim_escape_html() a tad bit. There is nothing wrong
with exiting out of a function early. In the abnormal case that
html==NULL, we just exit the function. It makes the meat of the function
nested one fewer level.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 19 Aug 2004 01:45:30 +0000 |
parents | 242a5a97c952 |
children | 3e7e294f56f3 |
line wrap: on
line diff
--- a/src/util.c Thu Aug 19 01:13:58 2004 +0000 +++ b/src/util.c Thu Aug 19 01:45:30 2004 +0000 @@ -1652,36 +1652,33 @@ char * gaim_escape_html(const char *html) { - char *escaped = NULL; - - if (html != NULL) { - const char *c = html; - GString *ret = g_string_new(""); - while (*c) { - switch(*c) { - case '&': - ret = g_string_append(ret, "&"); - break; - case '<': - ret = g_string_append(ret, "<"); - break; - case '>': - ret = g_string_append(ret, ">"); - break; - case '"': - ret = g_string_append(ret, """); - break; - default: - ret = g_string_append_c(ret, *c); - } - c++; + const char *c = html; + GString *ret = g_string_new(""); + + if (html == NULL) + return NULL; + + while (*c) { + switch (*c) { + case '&': + ret = g_string_append(ret, "&"); + break; + case '<': + ret = g_string_append(ret, "<"); + break; + case '>': + ret = g_string_append(ret, ">"); + break; + case '"': + ret = g_string_append(ret, """); + break; + default: + ret = g_string_append_c(ret, *c); } - - escaped = ret->str; - g_string_free(ret, FALSE); + c++; } - return escaped; + return g_string_free(ret, FALSE); } char *