# HG changeset patch # User Andreas Monitzer # Date 1184210695 0 # Node ID fdd07827ecb16f18f84f97ef36ace399787bcec3 # Parent c4d1a940aa838ebd27cbcd98bf34ae462f49fc89 Fixed a few style/efficiency/calling convention problems noted by rlaager diff -r c4d1a940aa83 -r fdd07827ecb1 libpurple/util.c --- a/libpurple/util.c Thu Jul 12 02:56:00 2007 +0000 +++ b/libpurple/util.c Thu Jul 12 03:24:55 2007 +0000 @@ -1365,7 +1365,7 @@ struct purple_parse_tag *pt = tags->data; if(xhtml) g_string_append_printf(xhtml, "", pt->dest_tag); - if(!strcmp(pt->src_tag, "a")) { + if(plain && !strcmp(pt->src_tag, "a")) { /* if this is a link, we have to add the url to the plaintext, too */ g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); } @@ -1518,7 +1518,7 @@ c = p; /* src and alt are required! */ if(src && xhtml) - g_string_append_printf(xhtml, "%s", g_strstrip(src->str), alt?alt->str:""); + g_string_append_printf(xhtml, "%s", g_strstrip(src->str), alt ? alt->str : ""); if(alt) { if(plain) plain = g_string_append(plain, alt->str); @@ -1555,7 +1555,8 @@ pt->src_tag = "a"; pt->dest_tag = "a"; tags = g_list_prepend(tags, pt); - g_string_append_printf(xhtml, "", g_strstrip(url->str)); + if(xhtml) + g_string_append_printf(xhtml, "", g_strstrip(url->str)); continue; } if(!g_ascii_strncasecmp(c, "' || *(c+5) == ' ')) { @@ -1736,11 +1737,9 @@ } g_list_free(tags); if(xhtml_out) - *xhtml_out = g_strdup(xhtml->str); + *xhtml_out = g_string_free(xhtml, FALSE); if(plain_out) - *plain_out = g_strdup(plain->str); - g_string_free(xhtml, TRUE); - g_string_free(plain, TRUE); + *plain_out = g_string_free(plain, FALSE); g_string_free(url, TRUE); }