diff src/util.c @ 14035:8bda65b88e49

[gaim-migrate @ 16638] A bunch of small changes. Mostly remove "if not null" checks before calling g_free, g_list_free, g_slist_free and g_strdup. Also use g_list_foreach() to call g_free to free strings in an array. And some whitespace changes here and there. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 05 Aug 2006 08:27:39 +0000
parents fe1c92e1494a
children 5e6d4c36630a
line wrap: on
line diff
--- a/src/util.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/util.c	Sat Aug 05 08:27:39 2006 +0000
@@ -926,8 +926,7 @@
 
 						/* don't store a blank attribute name */
 						if (len) {
-							if (name)
-								g_free(name);
+							g_free(name);
 							name = g_ascii_strdown(cur, len);
 						}
 
@@ -994,8 +993,7 @@
 	}
 
 	/* clean up any attribute name from a premature termination */
-	if (name)
-		g_free(name);
+	g_free(name);
 
 	if (found) {
 		*attributes = attribs;
@@ -1770,7 +1768,7 @@
 gaim_markup_linkify(const char *text)
 {
 	const char *c, *t, *q = NULL;
-	char *tmp, *tmpurlbuf, *url_buf;
+	char *tmpurlbuf, *url_buf;
 	gunichar g;
 	gboolean inside_html = FALSE;
 	int inside_paren = 0;
@@ -2023,9 +2021,7 @@
 		c++;
 
 	}
-	tmp = ret->str;
-	g_string_free(ret, FALSE);
-	return tmp;
+	return g_string_free(ret, FALSE);
 }
 
 char *
@@ -2110,8 +2106,7 @@
 				char *tmp;
 
 				tmp = g_queue_pop_head(q);
-				if (tmp)
-					g_free(tmp);
+				g_free(tmp);
 				/* z += 0; */
 			} else {
 				/* push it unto the stack */
@@ -3430,10 +3425,10 @@
 	gfud->callback = cb;
 	gfud->user_data  = user_data;
 	gfud->url = g_strdup(url);
-	gfud->user_agent = user_agent ? g_strdup(user_agent) : NULL;
+	gfud->user_agent = g_strdup(user_agent);
 	gfud->http11 = http11;
 	gfud->full = full;
-	gfud->request = request ? g_strdup(request) : NULL;
+	gfud->request = g_strdup(request);
 	gfud->include_headers = include_headers;
 
 	gaim_url_parse(url, &gfud->website.address, &gfud->website.port,
@@ -3677,8 +3672,7 @@
 	if ((utf8 != NULL) && (converted == strlen(str)))
 		return utf8;
 
-	if (utf8 != NULL)
-		g_free(utf8);
+	g_free(utf8);
 
 	return NULL;
 }