Mercurial > pidgin.yaz
changeset 18690:fdd07827ecb1
Fixed a few style/efficiency/calling convention problems noted by rlaager
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Thu, 12 Jul 2007 03:24:55 +0000 |
parents | c4d1a940aa83 |
children | 54a5fbeadd7c 6178b8c28143 |
files | libpurple/util.c |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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, "</%s>", 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, "<img src='%s' alt='%s' />", g_strstrip(src->str), alt?alt->str:""); + g_string_append_printf(xhtml, "<img src='%s' alt='%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, "<a href='%s'>", g_strstrip(url->str)); + if(xhtml) + g_string_append_printf(xhtml, "<a href='%s'>", g_strstrip(url->str)); continue; } if(!g_ascii_strncasecmp(c, "<font", 5) && (*(c+5) == '>' || *(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); }