changeset 1367:fe4da037be21

When g_new0() is used, drop redundant initializations to NULL, FALSE or 0, second pass.
author zas_
date Sun, 01 Mar 2009 23:14:19 +0000
parents ff3cd67235af
children bbd3a85a0534
files src/collect-table.c src/collect.c src/dupe.c src/editors.c src/exif.c src/filedata.c src/image-overlay.c src/img-view.c src/pan-item.c src/pan-view.c src/remote.c src/search.c src/ui_tree_edit.c src/utilops.c
diffstat 14 files changed, 13 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect-table.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/collect-table.c	Sun Mar 01 23:14:19 2009 +0000
@@ -2437,35 +2437,14 @@
 	gint i;
 
 	ct = g_new0(CollectTable, 1);
+	
 	ct->cd = cd;
-	ct->columns = 0;
-	ct->rows = 0;
-
-	ct->selection = NULL;
-	ct->prev_selection = NULL;
-
-	ct->tip_window = NULL;
 	ct->tip_delay_id = -1;
-
-	ct->marker_window = NULL;
-	ct->marker_info = NULL;
-
-	ct->status_label = NULL;
-	ct->extra_label = NULL;
-
-	ct->focus_row = 0;
-	ct->focus_column = 0;
-	ct->focus_info = NULL;
-
 	ct->show_text = options->show_icon_names;
 
 	ct->sync_idle_id = -1;
 	ct->drop_idle_id = -1;
 
-	ct->popup = NULL;
-	ct->drop_info = NULL;
-	ct->drop_list = NULL;
-
 	ct->scrolled = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ct->scrolled), GTK_SHADOW_IN);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ct->scrolled),
--- a/src/collect.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/collect.c	Sun Mar 01 23:14:19 2009 +0000
@@ -323,23 +323,10 @@
 
 	cd = g_new0(CollectionData, 1);
 
-	collection_list = g_list_append(collection_list, cd);
-
 	cd->ref = 1;	/* starts with a ref of 1 */
-
-	cd->list = NULL;
 	cd->sort_method = SORT_NONE;
-	cd->thumb_loader = NULL;
-	cd->info_updated_func = NULL;
-
-	cd->window_read = FALSE;
-	cd->window_x = 0;
-	cd->window_y = 0;
 	cd->window_w = COLLECT_DEF_WIDTH;
 	cd->window_h = COLLECT_DEF_HEIGHT;
-
-	cd->changed = FALSE;
-
 	cd->existence = g_hash_table_new(NULL, NULL);
 
 	if (path)
@@ -350,8 +337,6 @@
 		}
 	else
 		{
-		cd->path = NULL;
-
 		if (untitled_counter == 0)
 			{
 			cd->name = g_strdup(_("Untitled"));
@@ -366,6 +351,9 @@
 
 	file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM);
 
+
+	collection_list = g_list_append(collection_list, cd);
+	
 	return cd;
 }
 
@@ -1183,8 +1171,6 @@
 
 	cw = g_new0(CollectWindow, 1);
 
-	cw->close_dialog = NULL;
-
 	collection_window_list = g_list_append(collection_window_list, cw);
 
 	cw->cd = collection_new(path);
--- a/src/dupe.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/dupe.c	Sun Mar 01 23:14:19 2009 +0000
@@ -288,18 +288,8 @@
 	di = g_new0(DupeItem, 1);
 
 	di->fd = file_data_ref(fd);
-
-	di->group = NULL;
 	di->group_rank = 0.0;
 
-	di->simd = NULL;
-	di->checksum = 0;
-	di->md5sum = NULL;
-	di->width = 0;
-	di->height = 0;
-
-	di->second = FALSE;
-
 	return di;
 }
 
--- a/src/editors.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/editors.c	Sun Mar 01 23:14:19 2009 +0000
@@ -1057,8 +1057,6 @@
 	ed->flags = flags;
 	ed->editor = editor;
 	ed->total = (flags & EDITOR_SINGLE_COMMAND) ? 1 : g_list_length(list);
-	ed->count = 0;
-	ed->stopping = FALSE;
 	ed->callback = cb;
 	ed->data =  data;
 
--- a/src/exif.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/exif.c	Sun Mar 01 23:14:19 2009 +0000
@@ -511,8 +511,6 @@
 	item->tag = tag;
 	item->marker = marker;
 	item->elements = elements;
-	item->data = NULL;
-	item->data_len = 0;
 
 	switch (format)
 		{
@@ -1228,8 +1226,6 @@
 	g_free(pathl);
 
 	exif = g_new0(ExifData, 1);
-	exif->items = NULL;
-	exif->current = NULL;
 	exif->path = g_strdup(path);
 
 	res = exif_jpeg_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
--- a/src/filedata.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/filedata.c	Sun Mar 01 23:14:19 2009 +0000
@@ -346,17 +346,9 @@
 
 	fd = g_new0(FileData, 1);
 	
-	fd->path = NULL;
-	fd->name = NULL;
-	fd->collate_key_name = NULL;
-	fd->collate_key_name_nocase = NULL;
-	fd->original_path = NULL;
-
 	fd->size = st->st_size;
 	fd->date = st->st_mtime;
 	fd->mode = st->st_mode;
-	fd->thumb_pixbuf = NULL;
-	fd->sidecar_files = NULL;
 	fd->ref = 1;
 	fd->magick = 0x12345678;
 
--- a/src/image-overlay.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/image-overlay.c	Sun Mar 01 23:14:19 2009 +0000
@@ -1007,7 +1007,6 @@
 		osd->idle_id = -1;
 		osd->timer_id = -1;
 		osd->show = OSD_SHOW_NOTHING;
-		osd->histogram = NULL;
 		osd->x = options->image_overlay.x;
 		osd->y = options->image_overlay.y;
 		
--- a/src/img-view.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/img-view.c	Sun Mar 01 23:14:19 2009 +0000
@@ -833,10 +833,6 @@
 	if (!fd && !list && (!cd || !info)) return NULL;
 
 	vw = g_new0(ViewWindow, 1);
-	vw->fs = NULL;
-	vw->ss = NULL;
-	vw->list = NULL;
-	vw->list_pointer = NULL;
 
 	vw->window = window_new(GTK_WINDOW_TOPLEVEL, "view", PIXBUF_INLINE_ICON_VIEW, NULL, NULL);
 
--- a/src/pan-item.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/pan-item.c	Sun Mar 01 23:14:19 2009 +0000
@@ -450,6 +450,7 @@
 	PanItem *pi;
 
 	pi = g_new0(PanItem, 1);
+	
 	pi->type = PAN_ITEM_THUMB;
 	pi->fd = fd;
 	pi->x = x;
@@ -457,10 +458,6 @@
 	pi->width = PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2;
 	pi->height = PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2;
 
-	pi->pixbuf = NULL;
-
-	pi->queued = FALSE;
-
 	pw->list = g_list_prepend(pw->list, pi);
 
 	return pi;
@@ -849,8 +846,6 @@
 	ta = g_new0(PanTextAlignment, 1);
 
 	ta->pw = pw;
-	ta->column1 = NULL;
-	ta->column2 = NULL;
 	ta->x = x;
 	ta->y = y;
 	ta->key = g_strdup(key);
--- a/src/pan-view.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/pan-view.c	Sun Mar 01 23:14:19 2009 +0000
@@ -791,7 +791,6 @@
 			pg->y = j * ch / 2;
 			pg->w = cw;
 			pg->h = ch;
-			pg->list = NULL;
 
 			pw->list_grid = g_list_prepend(pw->list_grid, pg);
 
@@ -2360,11 +2359,6 @@
 
 	pw->ignore_symlinks = TRUE;
 
-	pw->list = NULL;
-	pw->list_static = NULL;
-	pw->list_grid = NULL;
-
-	pw->fs = NULL;
 	pw->overlay_id = -1;
 	pw->idle_id = -1;
 
--- a/src/remote.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/remote.c	Sun Mar 01 23:14:19 2009 +0000
@@ -226,15 +226,11 @@
 		}
 
 	rc = g_new0(RemoteConnection, 1);
+	
 	rc->server = TRUE;
 	rc->fd = fd;
 	rc->path = g_strdup(path);
 
-	rc->read_func = NULL;
-	rc->read_data = NULL;
-
-	rc->clients = NULL;
-
 	channel = g_io_channel_unix_new(rc->fd);
 	g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL); 
 	
--- a/src/search.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/search.c	Sun Mar 01 23:14:19 2009 +0000
@@ -2601,10 +2601,6 @@
 	sd->search_height = 480;
 	sd->search_width_end = 1024;
 	sd->search_height_end = 768;
-	sd->search_name = NULL;
-	sd->search_name_match_case = FALSE;
-	sd->search_comment = NULL;
-	sd->search_comment_match_case = FALSE;
 
 	sd->search_type = SEARCH_MATCH_NONE;
 
@@ -2616,16 +2612,13 @@
 	sd->match_comment = SEARCH_MATCH_CONTAINS;
 
 	sd->match_name_enable = TRUE;
-	sd->match_size_enable = FALSE;
-	sd->match_date_enable = FALSE;
-	sd->match_dimensions_enable = FALSE;
-	sd->match_similarity_enable = FALSE;
-	sd->match_keywords_enable = FALSE;
-	sd->match_comment_enable = FALSE;
 
 	sd->search_similarity = 95;
-	sd->search_similarity_path = example_file ? g_strdup(example_file->path) : NULL;
-	sd->search_similarity_cd = NULL;
+	
+	if (example_file)
+		{
+		sd->search_similarity_path = g_strdup(example_file->path);
+		}
 
 	sd->search_idle_id = -1;
 	sd->update_idle_id = -1;
--- a/src/ui_tree_edit.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/ui_tree_edit.c	Sun Mar 01 23:14:19 2009 +0000
@@ -209,7 +209,6 @@
 	ted = g_new0(TreeEditData, 1);
 
 	ted->old_name = g_strdup(text);
-	ted->new_name = NULL;
 
 	ted->edit_func = edit_func;
 	ted->edit_data = data;
--- a/src/utilops.c	Sun Mar 01 21:35:18 2009 +0000
+++ b/src/utilops.c	Sun Mar 01 23:14:19 2009 +0000
@@ -341,11 +341,12 @@
 	UtilityData *ud;
 
 	ud = g_new0(UtilityData, 1);
+	
 	ud->type = type;
 	ud->phase = UTILITY_PHASE_START;
 	ud->update_idle_id = -1;
 	ud->perform_idle_id = -1;
-	ud->external_command = NULL;
+	
 	return ud;
 }