pidgin: bb639209: Simplify a wee bit

markdoliner at pidgin.im markdoliner at pidgin.im
Thu Jul 30 19:45:41 EDT 2009


-----------------------------------------------------------------
Revision: bb639209698c518a3e6f1bf1ee2bca0742915560
Ancestor: 97533280c2542a68d67febc78e049fee918b9ca1
Author: markdoliner at pidgin.im
Date: 2009-07-30T23:43:01
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/bb639209698c518a3e6f1bf1ee2bca0742915560

Modified files:
        libpurple/protocols/yahoo/util.c

ChangeLog: 

Simplify a wee bit

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c	a5664d412d341465c3a529831b0aeb6f4d97027c
+++ libpurple/protocols/yahoo/util.c	ae9cf646f44c825fa1117e2a2125ae65303689a1
@@ -172,7 +172,6 @@ char *yahoo_convert_to_numeric(const cha
 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 @@ char *yahoo_convert_to_numeric(const cha
 		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 @@ char *yahoo_codes_to_html(const char *x)
 {
 	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 @@ char *yahoo_codes_to_html(const char *x)
 		}
 	}
 
-	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 @@ char *yahoo_html_to_codes(const char *sr
 {
 	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 @@ char *yahoo_html_to_codes(const char *sr
 		}
 	}
 
-	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);
 }


More information about the Commits mailing list