changeset 10331:20df7dd1c57c

[gaim-migrate @ 11538] Something I love about g_string's committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 09 Dec 2004 00:44:58 +0000
parents 4f5a7ddd3161
children 8d42237564f6
files src/xmlnode.c
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmlnode.c	Thu Dec 09 00:24:30 2004 +0000
+++ b/src/xmlnode.c	Thu Dec 09 00:44:58 2004 +0000
@@ -224,7 +224,6 @@
 xmlnode_get_data(xmlnode *node)
 {
 	GString *str = NULL;
-	char *ret = NULL;
 	xmlnode *c;
 
 	g_return_val_if_fail(node != NULL, NULL);
@@ -238,17 +237,14 @@
 		}
 	}
 
-	if(str) {
-		ret = str->str;
-		g_string_free(str, FALSE);
-	}
+	if (str == NULL)
+		return NULL;
 
-	return ret;
+	return g_string_free(str, FALSE);
 }
 
 static char *xmlnode_to_str_helper(xmlnode *node, int *len, gboolean formatting, int depth)
 {
-	char *ret;
 	GString *text = g_string_new("");
 	xmlnode *c;
 	char *node_name, *esc, *esc2, *tab = NULL;
@@ -311,11 +307,10 @@
 	if(tab)
 		g_free(tab);
 
-	ret = text->str;
 	if(len)
 		*len = text->len;
-	g_string_free(text, FALSE);
-	return ret;
+
+	return g_string_free(text, FALSE);
 }
 
 char *xmlnode_to_str(xmlnode *node, int *len) {