[kazehakase-svn] [3755] remove needless NULL check for g_free.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
Sun Feb 22 20:38:55 JST 2009


Revision: 3755
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3755
Author:   ikezoe
Date:     2009-02-22 20:38:55 +0900 (Sun, 22 Feb 2009)

Log Message:
-----------
remove needless NULL check for g_free.

Modified Paths:
--------------
    kazehakase/trunk/src/actions/kz-actions-dynamic.c
    kazehakase/trunk/src/actions/kz-actions.c
    kazehakase/trunk/src/kz-download-box.c
    kazehakase/trunk/src/kz-downloader-group.c
    kazehakase/trunk/src/kz-downloader.c
    kazehakase/trunk/src/kz-embed-event.c
    kazehakase/trunk/src/kz-profile.c
    kazehakase/trunk/src/kz-xml.c
    kazehakase/trunk/src/main.c

Modified: kazehakase/trunk/src/actions/kz-actions-dynamic.c
===================================================================
--- kazehakase/trunk/src/actions/kz-actions-dynamic.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/actions/kz-actions-dynamic.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -167,10 +167,10 @@
 	statusbar_message = g_strconcat("Copy to clipboard ", compress_str, NULL);
 	kz_statusbar_set_copied_text(KZ_STATUSBAR(kztab->kz->statusbar), statusbar_message);
 
-	if(str) g_free(str);
-	if(compress_str) g_free(compress_str);
-	if(text) g_free(text);
-	if(statusbar_message) g_free(statusbar_message);
+	g_free(str);
+	g_free(compress_str);
+	g_free(text);
+	g_free(statusbar_message);
 }
 
 void

Modified: kazehakase/trunk/src/actions/kz-actions.c
===================================================================
--- kazehakase/trunk/src/actions/kz-actions.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/actions/kz-actions.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -393,9 +393,9 @@
 	text = gtk_clipboard_wait_for_text(clipboard);
  	if (text)
 	{
- 		kz_entry_action_set_text (KZ_ENTRY_ACTION (entry), text);
+ 		kz_entry_action_set_text(KZ_ENTRY_ACTION(entry), text);
  		gtk_action_activate(entry);
- 		g_free (text);
+ 		g_free(text);
  	}
 }
 
@@ -1078,9 +1078,7 @@
 					       bookmark);
 	}
 
-	if (desc)
-		g_free(desc);
-
+	g_free(desc);
 	g_object_unref(bookmark);
 }
 
@@ -1263,7 +1261,7 @@
 	clip_dir_name = g_build_filename(KZ_GET_CLIPS_DIR, dir_name, NULL);
 	g_mkdir_with_parents(clip_dir_name, 0700);
 
-	source  = kz_embed_get_html_with_contents(embed, dir_name);
+	source = kz_embed_get_html_with_contents(embed, dir_name);
 
 	filename = g_build_filename(clip_dir_name,
 				    full_htmlname,
@@ -1277,8 +1275,7 @@
 	g_io_channel_shutdown(io, TRUE, NULL);
 	g_io_channel_unref(io);
 
-	if (source)
-		g_free(source);
+	g_free(source);
 	link = g_strconcat("file://", filename, NULL);
 	bookmark = kz_bookmark_new_with_attrs(title, link, NULL);
 	
@@ -2221,8 +2218,7 @@
 				combine_favicon(nav, uri, kz);
 				g_free(uri);
 			}
-			if (title)
-				g_free(title);
+			g_free(title);
 		}
 		else
 		{
@@ -2242,8 +2238,7 @@
 				combine_favicon(action, uri, kz);
 				g_free(uri);
 			}
-			if (title)
-				g_free(title);
+			g_free(title);
 		}
 		else 
 			combine_favicon(action, NULL, kz);
@@ -2373,7 +2368,7 @@
 					   -1,
 					   G_CALLBACK(act_switch_layout_engine),
 					   kz);
-#if 1
+
 	/* Back and Forward Action */
 	{
 		action = g_object_new(KZ_TYPE_NAVIGATION_ACTION,
@@ -2387,7 +2382,7 @@
 		gtk_action_group_add_action(action_group, action);
 		g_object_unref(action);
 	}
-#endif
+
 	/* StopReload action */
 	{
 		action = GTK_ACTION(kz_stop_reload_action_new(kz));

Modified: kazehakase/trunk/src/kz-download-box.c
===================================================================
--- kazehakase/trunk/src/kz-download-box.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/kz-download-box.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -335,16 +335,16 @@
 
 	/* create semitransparent icon image */
 	gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
-	icon_set = gtk_style_lookup_icon_set (GTK_WIDGET(dlbox)->style,
-					      GTK_STOCK_SAVE);
+	icon_set = gtk_style_lookup_icon_set(GTK_WIDGET(dlbox)->style,
+					     GTK_STOCK_SAVE);
 
 	if (icon_set != NULL)
 	{
-		orig_pixbuf = gtk_icon_set_render_icon (
+		orig_pixbuf = gtk_icon_set_render_icon(
 				icon_set,
 				icon->image->style,
-				gtk_widget_get_direction (icon->image),
-				GTK_WIDGET_STATE (icon->image),
+				gtk_widget_get_direction(icon->image),
+				GTK_WIDGET_STATE(icon->image),
 				GTK_ICON_SIZE_MENU,
 				icon->image,
 				"download icon");
@@ -503,8 +503,7 @@
 		gtk_image_set_from_pixbuf(GTK_IMAGE(icon->image),
 					  orig_pixbuf);
 		g_object_unref(pixbuf);
-		if(direction)
-			g_free(direction);
+                g_free(direction);
 	}
 	percent_str = g_strdup_printf("%s:%02d%%",
 				      kz_downloader_get_filename(dl),

Modified: kazehakase/trunk/src/kz-downloader-group.c
===================================================================
--- kazehakase/trunk/src/kz-downloader-group.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/kz-downloader-group.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -292,6 +292,7 @@
 
 	basename = g_path_get_basename(uri);
 	dl = kz_downloader_new_with_filename(uri, basename);
+	g_free(basename);
 	if (!dl)
 		return;
 
@@ -300,8 +301,6 @@
 	connect_signals(dlgrp, dl);
 
 	kz_downloader_to_file(dl);
-
-	g_free(basename);
 }
 
 

Modified: kazehakase/trunk/src/kz-downloader.c
===================================================================
--- kazehakase/trunk/src/kz-downloader.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/kz-downloader.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -224,8 +224,7 @@
 		priv->uri = g_value_dup_string(value);
 		break;
 	case PROP_FILENAME:
-		if (priv->file_name)
-			g_free(priv->file_name);
+                g_free(priv->file_name);
 		priv->file_name = g_value_dup_string(value);
 		break;
 	default:

Modified: kazehakase/trunk/src/kz-embed-event.c
===================================================================
--- kazehakase/trunk/src/kz-embed-event.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/kz-embed-event.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -92,20 +92,16 @@
 void
 kz_embed_event_free (KzEmbedEvent *event)
 {
-	if (event->link)
-		g_free(event->link);
+	g_free(event->link);
 	event->link = NULL;
 
-	if (event->linktext)
-		g_free(event->linktext);
+	g_free(event->linktext);
 	event->linktext = NULL;
 
-	if (event->img)
-		g_free(event->img);
+	g_free(event->img);
 	event->img = NULL;
 
-	if (event->frame_src)
-		g_free(event->frame_src);
+	g_free(event->frame_src);
 	event->frame_src = NULL;
 
 	event->element = NULL;

Modified: kazehakase/trunk/src/kz-profile.c
===================================================================
--- kazehakase/trunk/src/kz-profile.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/kz-profile.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -146,17 +146,11 @@
 	KzProfile *profile = KZ_PROFILE(object);
 	KzProfileList *p, *q;
 
-	if (profile->file)
-	{
-		g_free(profile->file);
-		profile->file = NULL;
-	}
+	g_free(profile->file);
+	profile->file = NULL;
 
-	if (profile->subfile)
-	{
-		g_free(profile->subfile);
-		profile->subfile = NULL;
-	}
+	g_free(profile->subfile);
+	profile->subfile = NULL;
 
 	for (p = profile->list; p; p = q)
 	{

Modified: kazehakase/trunk/src/kz-xml.c
===================================================================
--- kazehakase/trunk/src/kz-xml.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/kz-xml.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -1092,8 +1092,7 @@
 	cdata_text = g_strndup(str+j, i-j);
 	plain_text = remove_tag((const gchar*)cdata_text, (gsize)strlen(cdata_text));
 
-	if(cdata_text)
-		g_free(cdata_text);
+	g_free(cdata_text);
 
 	return plain_text;
 }

Modified: kazehakase/trunk/src/main.c
===================================================================
--- kazehakase/trunk/src/main.c	2009-02-22 11:38:54 UTC (rev 3754)
+++ kazehakase/trunk/src/main.c	2009-02-22 11:38:55 UTC (rev 3755)
@@ -115,17 +115,16 @@
 		 gpointer	  data,
 		 GError        **error)
 {
-	fprintf (stderr, "%s\n", (*error)->message);
-	g_error_free (*error);
-	return;
+	fprintf(stderr, "%s\n", (*error)->message);
+	g_error_free(*error);
 }
 
 static void
 free_goption()
 {
-	g_free (geometry_string);
-	g_strfreev (action_array);
-	g_option_context_free (context);
+	g_free(geometry_string);
+	g_strfreev(action_array);
+	g_option_context_free(context);
 }
 
 /* XXX: This function has side effect! */




More information about the Kazehakase-cvs mailing list
Back to archive index