Mercurial > pidgin.yaz
comparison libpurple/util.c @ 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 |
comparison
equal
deleted
inserted
replaced
18689:c4d1a940aa83 | 18690:fdd07827ecb1 |
---|---|
1363 if(tag) { | 1363 if(tag) { |
1364 while(tags) { | 1364 while(tags) { |
1365 struct purple_parse_tag *pt = tags->data; | 1365 struct purple_parse_tag *pt = tags->data; |
1366 if(xhtml) | 1366 if(xhtml) |
1367 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); | 1367 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); |
1368 if(!strcmp(pt->src_tag, "a")) { | 1368 if(plain && !strcmp(pt->src_tag, "a")) { |
1369 /* if this is a link, we have to add the url to the plaintext, too */ | 1369 /* if this is a link, we have to add the url to the plaintext, too */ |
1370 g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); | 1370 g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); |
1371 } | 1371 } |
1372 if(tags == tag) | 1372 if(tags == tag) |
1373 break; | 1373 break; |
1516 c++; | 1516 c++; |
1517 else | 1517 else |
1518 c = p; | 1518 c = p; |
1519 /* src and alt are required! */ | 1519 /* src and alt are required! */ |
1520 if(src && xhtml) | 1520 if(src && xhtml) |
1521 g_string_append_printf(xhtml, "<img src='%s' alt='%s' />", g_strstrip(src->str), alt?alt->str:""); | 1521 g_string_append_printf(xhtml, "<img src='%s' alt='%s' />", g_strstrip(src->str), alt ? alt->str : ""); |
1522 if(alt) { | 1522 if(alt) { |
1523 if(plain) | 1523 if(plain) |
1524 plain = g_string_append(plain, alt->str); | 1524 plain = g_string_append(plain, alt->str); |
1525 if(!src && xhtml) | 1525 if(!src && xhtml) |
1526 xhtml = g_string_append(xhtml, alt->str); | 1526 xhtml = g_string_append(xhtml, alt->str); |
1553 c = p; | 1553 c = p; |
1554 pt = g_new0(struct purple_parse_tag, 1); | 1554 pt = g_new0(struct purple_parse_tag, 1); |
1555 pt->src_tag = "a"; | 1555 pt->src_tag = "a"; |
1556 pt->dest_tag = "a"; | 1556 pt->dest_tag = "a"; |
1557 tags = g_list_prepend(tags, pt); | 1557 tags = g_list_prepend(tags, pt); |
1558 g_string_append_printf(xhtml, "<a href='%s'>", g_strstrip(url->str)); | 1558 if(xhtml) |
1559 g_string_append_printf(xhtml, "<a href='%s'>", g_strstrip(url->str)); | |
1559 continue; | 1560 continue; |
1560 } | 1561 } |
1561 if(!g_ascii_strncasecmp(c, "<font", 5) && (*(c+5) == '>' || *(c+5) == ' ')) { | 1562 if(!g_ascii_strncasecmp(c, "<font", 5) && (*(c+5) == '>' || *(c+5) == ' ')) { |
1562 const char *p = c; | 1563 const char *p = c; |
1563 GString *style = g_string_new(""); | 1564 GString *style = g_string_new(""); |
1734 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); | 1735 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); |
1735 } | 1736 } |
1736 } | 1737 } |
1737 g_list_free(tags); | 1738 g_list_free(tags); |
1738 if(xhtml_out) | 1739 if(xhtml_out) |
1739 *xhtml_out = g_strdup(xhtml->str); | 1740 *xhtml_out = g_string_free(xhtml, FALSE); |
1740 if(plain_out) | 1741 if(plain_out) |
1741 *plain_out = g_strdup(plain->str); | 1742 *plain_out = g_string_free(plain, FALSE); |
1742 g_string_free(xhtml, TRUE); | |
1743 g_string_free(plain, TRUE); | |
1744 g_string_free(url, TRUE); | 1743 g_string_free(url, TRUE); |
1745 } | 1744 } |
1746 | 1745 |
1747 /* The following are probably reasonable changes: | 1746 /* The following are probably reasonable changes: |
1748 * - \n should be converted to a normal space | 1747 * - \n should be converted to a normal space |