Skip to content

Commit

Permalink
When g_new0() is used, drop redundant initializations to NULL, FALSE …
Browse files Browse the repository at this point in the history
…or 0.
  • Loading branch information
Laurent Monin committed Mar 1, 2009
1 parent 276cb9b commit 16754fd
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 115 deletions.
32 changes: 0 additions & 32 deletions src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,49 +1711,17 @@ ImageWindow *image_new(gint frame)

imd = g_new0(ImageWindow, 1);

imd->top_window = NULL;
imd->title = NULL;
imd->title_right = NULL;
imd->title_show_zoom = FALSE;

imd->unknown = TRUE;

imd->has_frame = -1; /* not initialized; for image_set_frame */
imd->top_window_sync = FALSE;

imd->delay_alter_type = ALTER_NONE;

imd->read_ahead_il = NULL;
imd->read_ahead_fd = NULL;

imd->completed = FALSE;
imd->state = IMAGE_STATE_NONE;

imd->color_profile_enable = FALSE;
imd->color_profile_input = 0;
imd->color_profile_screen = 0;
imd->color_profile_use_image = FALSE;
imd->color_profile_from_image = COLOR_PROFILE_NONE;

imd->auto_refresh = FALSE;

imd->delay_flip = FALSE;

imd->func_update = NULL;
imd->func_complete = NULL;
imd->func_tile_request = NULL;
imd->func_tile_dispose = NULL;

imd->func_button = NULL;
imd->func_scroll = NULL;

imd->orientation = 1;

imd->pr = GTK_WIDGET(pixbuf_renderer_new());

image_options_set(imd);


imd->widget = gtk_vbox_new(0, 0);

image_set_frame(imd, frame);
Expand Down
6 changes: 0 additions & 6 deletions src/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -2016,15 +2016,9 @@ LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,

// lw->options.tools_float = popped;
// lw->options.tools_hidden = hidden;

lw->utility_box = NULL;
lw->bar_sort = NULL;
// lw->bar_sort_enabled = options->panels.sort.enabled;

lw->bar = NULL;
// lw->bar_enabled = options->panels.info.enabled;

lw->exif_window = NULL;
/* default layout */

layout_config_parse(lw->options.style, lw->options.order,
Expand Down
11 changes: 0 additions & 11 deletions src/slideshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,21 +358,10 @@ static SlideShowData *real_slideshow_start(ImageWindow *imd, LayoutWindow *lw,
ss = g_new0(SlideShowData, 1);

ss->imd = imd;

ss->filelist = filelist;
ss->cd = cd;
ss->layout = lw;
ss->dir_fd = NULL;

ss->list = NULL;
ss->list_done = NULL;

ss->from_selection = FALSE;

ss->stop_func = NULL;

ss->timeout_id = -1;
ss->paused = FALSE;

if (ss->filelist)
{
Expand Down
7 changes: 1 addition & 6 deletions src/thumb.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,11 @@ ThumbLoader *thumb_loader_new(gint width, gint height)
}

tl = g_new0(ThumbLoader, 1);
tl->standard_loader = FALSE;
tl->fd = NULL;

tl->cache_enable = options->thumbnails.enable_caching;
tl->cache_hit = FALSE;
tl->percent_done = 0.0;
tl->max_w = width;
tl->max_h = height;

tl->il = NULL;

tl->idle_done_id = -1;

return tl;
Expand Down
7 changes: 0 additions & 7 deletions src/thumb_standard.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,9 @@ ThumbLoaderStd *thumb_loader_std_new(gint width, gint height)
tl = g_new0(ThumbLoaderStd, 1);

tl->standard_loader = TRUE;

tl->requested_width = width;
tl->requested_height = height;

tl->il = NULL;
tl->fd = NULL;

tl->cache_enable = options->thumbnails.enable_caching;
tl->cache_local = FALSE;
tl->cache_retry = FALSE;

return tl;
}
Expand Down
4 changes: 0 additions & 4 deletions src/ui_pathsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,10 +1033,6 @@ GtkWidget *path_selection_new_with_files(GtkWidget *entry, const gchar *path,
GtkCellRenderer *renderer;

dd = g_new0(Dest_Data, 1);
dd->show_hidden = FALSE;
dd->select_func = NULL;
dd->select_data = NULL;
dd->gd = NULL;

table = gtk_table_new(4, (filter != NULL) ? 3 : 1, FALSE);
gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP);
Expand Down
9 changes: 1 addition & 8 deletions src/ui_tabcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,17 +798,10 @@ void tab_completion_add_to_entry(GtkWidget *entry, void (*enter_func)(const gcha
}

td = g_new0(TabCompData, 1);

td->entry = entry;
td->dir_path = NULL;
td->file_list = NULL;
td->enter_func = enter_func;
td->enter_data = data;
td->tab_func = NULL;
td->tab_data = NULL;

td->has_history = FALSE;
td->history_key = NULL;
td->history_levels = 0;

g_object_set_data(G_OBJECT(td->entry), "tab_completion_data", td);

Expand Down
11 changes: 0 additions & 11 deletions src/view_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,7 @@ ViewDir *vd_new(DirViewType type, FileData *dir_fd)

ViewDir *vd = g_new0(ViewDir, 1);

vd->dir_fd = NULL;
vd->click_fd = NULL;

vd->drop_fd = NULL;
vd->drop_list = NULL;
vd->drop_scroll_id = -1;
vd->drop_list = NULL;

vd->popup = NULL;

vd->dnd_drop_leave_func = NULL;
vd->dnd_drop_update_func = NULL;

vd->widget = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vd->widget), GTK_SHADOW_IN);
Expand Down
3 changes: 1 addition & 2 deletions src/view_dir_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,8 @@ ViewDir *vdlist_new(ViewDir *vd, FileData *dir_fd)
GtkCellRenderer *renderer;

vd->info = g_new0(ViewDirInfoList, 1);
vd->type = DIRVIEW_LIST;

VDLIST(vd)->list = NULL;
vd->type = DIRVIEW_LIST;

store = gtk_list_store_new(5, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
vd->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
Expand Down
3 changes: 1 addition & 2 deletions src/view_dir_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,10 +957,9 @@ ViewDir *vdtree_new(ViewDir *vd, FileData *dir_fd)
GtkCellRenderer *renderer;

vd->info = g_new0(ViewDirInfoTree, 1);
vd->type = DIRVIEW_TREE;

vd->type = DIRVIEW_TREE;
VDTREE(vd)->drop_expand_id = -1;
VDTREE(vd)->busy_ref = 0;

vd->dnd_drop_leave_func = vdtree_dnd_drop_expand_cancel;
vd->dnd_drop_update_func = vdtree_dnd_drop_expand;
Expand Down
13 changes: 1 addition & 12 deletions src/view_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,21 +679,10 @@ ViewFile *vf_new(FileViewType type, FileData *dir_fd)
ViewFile *vf;

vf = g_new0(ViewFile, 1);

vf->type = type;

vf->info = NULL;
vf->dir_fd = NULL;
vf->list = NULL;

vf->sort_method = SORT_NAME;
vf->sort_ascend = TRUE;

vf->thumbs_running = FALSE;
vf->thumbs_loader = NULL;
vf->thumbs_filedata = NULL;

vf->popup = NULL;

vf->refresh_idle_id = -1;

vf->scrolled = gtk_scrolled_window_new(NULL, NULL);
Expand Down
9 changes: 0 additions & 9 deletions src/view_file_icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2475,16 +2475,7 @@ ViewFile *vficon_new(ViewFile *vf, FileData *dir_fd)

vf->info = g_new0(ViewFileInfoIcon, 1);

VFICON(vf)->selection = NULL;
VFICON(vf)->prev_selection = NULL;

VFICON(vf)->tip_window = NULL;
VFICON(vf)->tip_delay_id = -1;

VFICON(vf)->focus_row = 0;
VFICON(vf)->focus_column = 0;
VFICON(vf)->focus_id = NULL;

VFICON(vf)->show_text = options->show_icon_names;

store = gtk_list_store_new(1, G_TYPE_POINTER);
Expand Down
5 changes: 0 additions & 5 deletions src/view_file_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -1936,17 +1936,12 @@ ViewFile *vflist_new(ViewFile *vf, FileData *dir_fd)
{
GtkTreeStore *store;
GtkTreeSelection *selection;

GType flist_types[FILE_COLUMN_COUNT];
gint i;
gint column;

vf->info = g_new0(ViewFileInfoList, 1);

VFLIST(vf)->click_fd = NULL;
VFLIST(vf)->select_fd = NULL;
VFLIST(vf)->thumbs_enabled = FALSE;

VFLIST(vf)->select_idle_id = -1;

flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
Expand Down

0 comments on commit 16754fd

Please sign in to comment.