From: <the...@us...> - 2006-08-05 09:17:13
|
Revision: 16643 Author: thekingant Date: 2006-08-05 02:17:09 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16643&view=rev Log Message: ----------- Return g_string_free(str, FALSE) directly instead of assigning str->str to a temporary directory and returning that. Modified Paths: -------------- trunk/src/gtkimhtml.c trunk/src/util.c Modified: trunk/src/gtkimhtml.c =================================================================== --- trunk/src/gtkimhtml.c 2006-08-05 09:11:46 UTC (rev 16642) +++ trunk/src/gtkimhtml.c 2006-08-05 09:17:09 UTC (rev 16643) @@ -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, "<!--StartFragment-->\r\n"); g_string_append(clipboard, html); g_string_append(clipboard, "\r\n<!--EndFragment-->"); - 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[] = { Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-08-05 09:11:46 UTC (rev 16642) +++ trunk/src/util.c 2006-08-05 09:17:09 UTC (rev 16643) @@ -2026,41 +2026,41 @@ char * gaim_unescape_html(const char *html) { - char *unescaped = NULL; + const char *c; + GString *ret; - 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, "<br>", 4)) { - ret = g_string_append_c(ret, '\n'); - c += 4; - } else { - ret = g_string_append_c(ret, *c); - c++; - } + 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, "<br>", 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); + } char * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |