comparison src/util.c @ 10732:c4cb90065e1d

[gaim-migrate @ 12334] "gaim_escape_html (according to Ethan) predates g_markup_escape_text. Current code in Gaim uses both functions. This patch removes gaim_escape_html from the API and replaces all calls in the Gaim tree with g_markup_escape_text. I included a ChangeLog.API note. As far as I can tell, this still works perfectly. This is obviously intended for HEAD only, as it removes a public function." --rlaager this was discussed extensively this morning committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 26 Mar 2005 02:43:49 +0000
parents 783ca1f1ebdb
children 8002e95c0809
comparison
equal deleted inserted replaced
10731:783ca1f1ebdb 10732:c4cb90065e1d
1671 g_string_free(ret, FALSE); 1671 g_string_free(ret, FALSE);
1672 return tmp; 1672 return tmp;
1673 } 1673 }
1674 1674
1675 char * 1675 char *
1676 gaim_escape_html(const char *html) {
1677 const char *c = html;
1678 GString *ret;
1679
1680 if (html == NULL)
1681 return NULL;
1682
1683 ret = g_string_new("");
1684
1685 while (*c) {
1686 switch (*c) {
1687 case '&':
1688 ret = g_string_append(ret, "&amp;");
1689 break;
1690 case '<':
1691 ret = g_string_append(ret, "&lt;");
1692 break;
1693 case '>':
1694 ret = g_string_append(ret, "&gt;");
1695 break;
1696 case '"':
1697 ret = g_string_append(ret, "&quot;");
1698 break;
1699 default:
1700 ret = g_string_append_c(ret, *c);
1701 }
1702 c++;
1703 }
1704
1705 return g_string_free(ret, FALSE);
1706 }
1707
1708 char *
1709 gaim_unescape_html(const char *html) { 1676 gaim_unescape_html(const char *html) {
1710 char *unescaped = NULL; 1677 char *unescaped = NULL;
1711 1678
1712 if (html != NULL) { 1679 if (html != NULL) {
1713 const char *c = html; 1680 const char *c = html;