When g_new0() is used, drop redundant initializations to NULL, FALSE or 0, second...
authorLaurent Monin <geeqie@norz.org>
Sun, 1 Mar 2009 23:14:19 +0000 (23:14 +0000)
committerLaurent Monin <geeqie@norz.org>
Sun, 1 Mar 2009 23:14:19 +0000 (23:14 +0000)
14 files changed:
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

index 37b769e..c764911 100644 (file)
@@ -2437,35 +2437,14 @@ CollectTable *collection_table_new(CollectionData *cd)
        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),
index 8b47552..0d3c8d6 100644 (file)
@@ -323,23 +323,10 @@ CollectionData *collection_new(const gchar *path)
 
        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 @@ CollectionData *collection_new(const gchar *path)
                }
        else
                {
-               cd->path = NULL;
-
                if (untitled_counter == 0)
                        {
                        cd->name = g_strdup(_("Untitled"));
@@ -366,6 +351,9 @@ CollectionData *collection_new(const gchar *path)
 
        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 @@ CollectWindow *collection_window_new(const gchar *path)
 
        cw = g_new0(CollectWindow, 1);
 
-       cw->close_dialog = NULL;
-
        collection_window_list = g_list_append(collection_window_list, cw);
 
        cw->cd = collection_new(path);
index 9252a0e..eee5e11 100644 (file)
@@ -288,18 +288,8 @@ static DupeItem *dupe_item_new(FileData *fd)
        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;
 }
 
index 2632dcd..c3cb036 100644 (file)
@@ -1057,8 +1057,6 @@ static gint editor_command_start(const EditorDescription *editor, const gchar *t
        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;
 
index 2dc8b65..00246cf 100644 (file)
@@ -511,8 +511,6 @@ ExifItem *exif_item_new(ExifFormatType format, guint tag,
        item->tag = tag;
        item->marker = marker;
        item->elements = elements;
-       item->data = NULL;
-       item->data_len = 0;
 
        switch (format)
                {
@@ -1228,8 +1226,6 @@ ExifData *exif_read(gchar *path, gchar *sidecar_path, GHashTable *modified_xmp)
        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);
index d4a3570..3504175 100644 (file)
@@ -346,17 +346,9 @@ static FileData *file_data_new(const gchar *path_utf8, struct stat *st, gboolean
 
        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;
 
index e46e89e..af5db8e 100644 (file)
@@ -1007,7 +1007,6 @@ static void image_osd_enable(ImageWindow *imd, OsdShowFlags show)
                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;
                
index 5769741..9bc862f 100644 (file)
@@ -833,10 +833,6 @@ static ViewWindow *real_view_window_new(FileData *fd, GList *list, CollectionDat
        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);
 
index d782d24..f976803 100644 (file)
@@ -450,6 +450,7 @@ PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y)
        PanItem *pi;
 
        pi = g_new0(PanItem, 1);
+       
        pi->type = PAN_ITEM_THUMB;
        pi->fd = fd;
        pi->x = x;
@@ -457,10 +458,6 @@ PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y)
        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 @@ PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gc
        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);
index 949c03e..6c15dfb 100644 (file)
@@ -791,7 +791,6 @@ static void pan_grid_build(PanWindow *pw, gint width, gint height, gint grid_siz
                        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 @@ static void pan_window_new_real(FileData *dir_fd)
 
        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;
 
index 8b0a504..07a3932 100644 (file)
@@ -226,15 +226,11 @@ static RemoteConnection *remote_server_open(const gchar *path)
                }
 
        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); 
        
index 05db77e..864144e 100644 (file)
@@ -2601,10 +2601,6 @@ void search_new(FileData *dir_fd, FileData *example_file)
        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 @@ void search_new(FileData *dir_fd, FileData *example_file)
        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;
index c2ff364..8c3c40d 100644 (file)
@@ -209,7 +209,6 @@ gint tree_edit_by_path(GtkTreeView *tree, GtkTreePath *tpath, gint column, const
        ted = g_new0(TreeEditData, 1);
 
        ted->old_name = g_strdup(text);
-       ted->new_name = NULL;
 
        ted->edit_func = edit_func;
        ted->edit_data = data;
index 5c824cc..e40e875 100644 (file)
@@ -341,11 +341,12 @@ static UtilityData *file_util_data_new(UtilityType type)
        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;
 }