# HG changeset patch # User Mark Doliner # Date 1248997381 0 # Node ID a0a8b61301c8f54d9caeb728ab53be42281a5bcc # Parent 9d5d6b9ae18ae4af9a56dbd6ef0388bee03f34f9 Simplify a wee bit diff -r 9d5d6b9ae18a -r a0a8b61301c8 libpurple/protocols/yahoo/util.c --- a/libpurple/protocols/yahoo/util.c Thu Jul 30 16:02:21 2009 +0000 +++ b/libpurple/protocols/yahoo/util.c Thu Jul 30 23:43:01 2009 +0000 @@ -172,7 +172,6 @@ char *yahoo_convert_to_numeric(const char *str) { GString *gstr = NULL; - char *retstr; const unsigned char *p; gstr = g_string_sized_new(strlen(str) * 6 + 1); @@ -181,11 +180,7 @@ g_string_append_printf(gstr, "&#%u;", *p); } - retstr = gstr->str; - - g_string_free(gstr, FALSE); - - return retstr; + return g_string_free(gstr, FALSE); } /* @@ -345,7 +340,7 @@ { GString *s, *tmp; int i, j, xs, nomoreendtags = 0; /* s/endtags/closinganglebrackets */ - char *match, *ret; + char *match; s = g_string_sized_new(strlen(x)); @@ -430,10 +425,8 @@ } } - ret = s->str; - g_string_free(s, FALSE); - purple_debug_misc("yahoo", "yahoo_codes_to_html: Returning string: '%s'.\n", ret); - return ret; + purple_debug_misc("yahoo", "yahoo_codes_to_html: Returning string: '%s'.\n", s->str); + return g_string_free(s, FALSE); } /* borrowed from gtkimhtml */ @@ -642,7 +635,7 @@ { int i, j, len; GString *dest; - char *ret, *esc; + char *esc; GQueue *colors, *tags; GQueue *ftattr = NULL; gboolean no_more_specials = FALSE; @@ -827,15 +820,12 @@ } } - ret = dest->str; - g_string_free(dest, FALSE); - - esc = g_strescape(ret, NULL); + esc = g_strescape(dest->str, NULL); purple_debug_misc("yahoo", "yahoo_html_to_codes: Returning string: '%s'.\n", esc); g_free(esc); yahoo_htc_queue_cleanup(colors); yahoo_htc_queue_cleanup(tags); - return ret; + return g_string_free(dest, FALSE); }