# HG changeset patch # User Mark Doliner # Date 1246611951 0 # Node ID c0075538109b9e8450a116d5386a0e1a7c85a02b # Parent 46e182c1c14f1bb70b762dce7c8ff2fc36f89b3b Formatting changes, no functionality. * Return early if html is null (instead of indenting everything one level) * No need to set ret=g_string_append(ret, blah); diff -r 46e182c1c14f -r c0075538109b libpurple/util.c --- a/libpurple/util.c Fri Jul 03 06:03:01 2009 +0000 +++ b/libpurple/util.c Fri Jul 03 09:05:51 2009 +0000 @@ -2399,30 +2399,32 @@ return g_string_free(ret, FALSE); } -char * -purple_unescape_html(const char *html) { - if (html != NULL) { - const char *c = html; - GString *ret = g_string_new(""); - while (*c) { - int len; - const char *ent; - - if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { - ret = g_string_append(ret, ent); - c += len; - } else if (!strncmp(c, "
", 4)) { - ret = g_string_append_c(ret, '\n'); - c += 4; - } else { - ret = g_string_append_c(ret, *c); - c++; - } +char *purple_unescape_html(const char *html) +{ + GString *ret; + const char *c = html; + + if (html == NULL) + return NULL; + + ret = g_string_new(""); + while (*c) { + int len; + const char *ent; + + if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { + g_string_append(ret, ent); + c += len; + } else if (!strncmp(c, "
", 4)) { + g_string_append_c(ret, '\n'); + c += 4; + } else { + g_string_append_c(ret, *c); + c++; } - return g_string_free(ret, FALSE); } - return NULL; + return g_string_free(ret, FALSE); } char *