diff src/util.c @ 14039:5e6d4c36630a

[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 <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 05 Aug 2006 09:17:09 +0000
parents 8bda65b88e49
children 426a98fa4527
line wrap: on
line diff
--- 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, "&amp;", 5)) {
-				ret = g_string_append_c(ret, '&');
-				c += 5;
-			} else if (!strncmp(c, "&lt;", 4)) {
-				ret = g_string_append_c(ret, '<');
-				c += 4;
-			} else if (!strncmp(c, "&gt;", 4)) {
-				ret = g_string_append_c(ret, '>');
-				c += 4;
-			} else if (!strncmp(c, "&quot;", 6)) {
-				ret = g_string_append_c(ret, '"');
-				c += 6;
-			} else if (!strncmp(c, "&apos;", 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++;
-			}
+	const char *c;
+	GString *ret;
+
+	if (html == NULL)
+		return NULL;
+
+	c = html;
+	ret = g_string_new("");
+	while (*c) {
+		if (!strncmp(c, "&amp;", 5)) {
+			ret = g_string_append_c(ret, '&');
+			c += 5;
+		} else if (!strncmp(c, "&lt;", 4)) {
+			ret = g_string_append_c(ret, '<');
+			c += 4;
+		} else if (!strncmp(c, "&gt;", 4)) {
+			ret = g_string_append_c(ret, '>');
+			c += 4;
+		} else if (!strncmp(c, "&quot;", 6)) {
+			ret = g_string_append_c(ret, '"');
+			c += 6;
+		} else if (!strncmp(c, "&apos;", 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);
 
 }