# HG changeset patch # User Mark Doliner # Date 1154769429 0 # Node ID 5e6d4c36630a06761ea91158087c3b996d24cd64 # Parent 443aaa05a7c32bbee4dbe30f3fa9d1cee2635fa7 [gaim-migrate @ 16643] Return g_string_free(str, FALSE) directly instead of assigning str->str to a temporary directory and returning that. committer: Tailor Script diff -r 443aaa05a7c3 -r 5e6d4c36630a src/gtkimhtml.c --- a/src/gtkimhtml.c Sat Aug 05 09:11:46 2006 +0000 +++ b/src/gtkimhtml.c Sat Aug 05 09:17:09 2006 +0000 @@ -220,7 +220,6 @@ int length; GString *clipboard; gchar *tmp; - gchar *ret; if (html == NULL) return NULL; @@ -238,14 +237,8 @@ g_string_append(clipboard, "\r\n"); g_string_append(clipboard, html); g_string_append(clipboard, "\r\n"); - ret = clipboard->str; - g_string_free(clipboard, FALSE); - -#if 0 /* Debugging for Windows clipboard */ - gaim_debug_info("imhtml clipboard", "from gaim: %s\n", ret); -#endif - - return ret; + + return g_string_free(clipboard, FALSE); } static void clipboard_copy_html_win32(GtkIMHtml *imhtml) { @@ -2229,11 +2222,9 @@ e++; } } - g_free(val); - val = ret->str; - g_string_free(ret, FALSE); - return val; + + return g_string_free(ret, FALSE); } static const char *accepted_protocols[] = { diff -r 443aaa05a7c3 -r 5e6d4c36630a src/util.c --- a/src/util.c Sat Aug 05 09:11:46 2006 +0000 +++ b/src/util.c Sat Aug 05 09:17:09 2006 +0000 @@ -2026,40 +2026,40 @@ char * gaim_unescape_html(const char *html) { - char *unescaped = NULL; - - if (html != NULL) { - const char *c = html; - GString *ret = g_string_new(""); - while (*c) { - if (!strncmp(c, "&", 5)) { - ret = g_string_append_c(ret, '&'); - c += 5; - } else if (!strncmp(c, "<", 4)) { - ret = g_string_append_c(ret, '<'); - c += 4; - } else if (!strncmp(c, ">", 4)) { - ret = g_string_append_c(ret, '>'); - c += 4; - } else if (!strncmp(c, """, 6)) { - ret = g_string_append_c(ret, '"'); - c += 6; - } else if (!strncmp(c, "'", 6)) { - ret = g_string_append_c(ret, '\''); - c += 6; - } else if (!strncmp(c, "
", 4)) { - ret = g_string_append_c(ret, '\n'); - c += 4; - } else { - ret = g_string_append_c(ret, *c); - c++; - } + const char *c; + GString *ret; + + if (html == NULL) + return NULL; + + c = html; + ret = g_string_new(""); + while (*c) { + if (!strncmp(c, "&", 5)) { + ret = g_string_append_c(ret, '&'); + c += 5; + } else if (!strncmp(c, "<", 4)) { + ret = g_string_append_c(ret, '<'); + c += 4; + } else if (!strncmp(c, ">", 4)) { + ret = g_string_append_c(ret, '>'); + c += 4; + } else if (!strncmp(c, """, 6)) { + ret = g_string_append_c(ret, '"'); + c += 6; + } else if (!strncmp(c, "'", 6)) { + ret = g_string_append_c(ret, '\''); + c += 6; + } else if (!strncmp(c, "
", 4)) { + ret = g_string_append_c(ret, '\n'); + c += 4; + } else { + ret = g_string_append_c(ret, *c); + c++; } - - unescaped = ret->str; - g_string_free(ret, FALSE); } - return unescaped; + + return g_string_free(ret, FALSE); }