From 02ad66458b97d359e9612846624e49f42d7109ba Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Tue, 3 Jun 2008 11:24:16 +0000 Subject: [PATCH] Drop initialization to NULL since filelist_read() will take care of it. --- src/bar_sort.c | 2 +- src/cache_maint.c | 7 ++----- src/collect-io.c | 2 +- src/collect-table.c | 4 ++-- src/dupe.c | 3 ++- src/filedata.c | 8 ++++---- src/img-view.c | 15 ++++++--------- src/main.c | 2 +- src/pan-util.c | 4 ++-- src/utilops.c | 8 ++++---- src/view_dir_list.c | 2 -- src/view_dir_tree.c | 1 - src/view_file_list.c | 6 +++--- 13 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/bar_sort.c b/src/bar_sort.c index f891d64b..1d4c3450 100644 --- a/src/bar_sort.c +++ b/src/bar_sort.c @@ -89,7 +89,7 @@ static void bar_sort_add_close(SortData *sd); static void bar_sort_collection_list_build(GtkWidget *bookmarks) { gchar *collect_path; - GList *list = NULL; + GList *list; GList *work; history_list_free_key(SORT_KEY_COLLECTIONS); diff --git a/src/cache_maint.c b/src/cache_maint.c index b6df9fdf..81bb15a7 100644 --- a/src/cache_maint.c +++ b/src/cache_maint.c @@ -274,7 +274,7 @@ static void cache_maintain_home_stop_cb(GenericDialog *gd, gpointer data) void cache_maintain_home(gint metadata, gint clear, GtkWidget *parent) { CMData *cm; - GList *dlist = NULL; + GList *dlist; gchar *base; const gchar *msg; const gchar *cache_folder; @@ -290,7 +290,7 @@ void cache_maintain_home(gint metadata, gint clear, GtkWidget *parent) } base = g_build_filename(homedir(), cache_folder, NULL); - + if (!filelist_read(base, NULL, &dlist)) { g_free(base); @@ -1011,19 +1011,16 @@ static void cache_manager_standard_clean_start_cb(GenericDialog *gd, gpointer da gtk_progress_bar_set_text(GTK_PROGRESS_BAR(cd->progress), _("running...")); path = g_build_filename(homedir(), THUMB_FOLDER_GLOBAL, THUMB_FOLDER_NORMAL, NULL); - list = NULL; filelist_read(path, &list, NULL); cd->list = list; g_free(path); path = g_build_filename(homedir(), THUMB_FOLDER_GLOBAL, THUMB_FOLDER_LARGE, NULL); - list = NULL; filelist_read(path, &list, NULL); cd->list = g_list_concat(cd->list, list); g_free(path); path = g_build_filename(homedir(), THUMB_FOLDER_GLOBAL, THUMB_FOLDER_FAIL, NULL); - list = NULL; filelist_read(path, &list, NULL); cd->list = g_list_concat(cd->list, list); g_free(path); diff --git a/src/collect-io.c b/src/collect-io.c index f11e2730..29e2560e 100644 --- a/src/collect-io.c +++ b/src/collect-io.c @@ -665,7 +665,7 @@ static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **p static void collect_manager_refresh(void) { - GList *list = NULL; + GList *list; GList *work; gchar *base; diff --git a/src/collect-table.c b/src/collect-table.c index 047119c8..ca0a757b 100644 --- a/src/collect-table.c +++ b/src/collect-table.c @@ -1900,8 +1900,8 @@ void collection_table_refresh(CollectTable *ct) static void collection_table_add_dir_recursive(CollectTable *ct, gchar *path, gint recursive) { - GList *d = NULL; - GList *f = NULL; + GList *d; + GList *f; GList *work; if (!filelist_read(path, &f, recursive ? &d : NULL)) diff --git a/src/dupe.c b/src/dupe.c index 6551f463..9e73c7e6 100644 --- a/src/dupe.c +++ b/src/dupe.c @@ -1733,6 +1733,7 @@ static void dupe_files_add(DupeWindow *dw, CollectionData *collection, CollectIn else if (isdir(fd->path) && recurse) { GList *f, *d; + if (filelist_read(fd->path, &f, &d)) { GList *work; @@ -3306,7 +3307,7 @@ static void confirm_dir_list_add(GtkWidget *widget, gpointer data) work = work->next; if (isdir(fd->path)) { - GList *list = NULL; + GList *list; filelist_read(fd->path, &list, NULL); list = filelist_filter(list, FALSE); diff --git a/src/filedata.c b/src/filedata.c index 04d6dc2f..78afa87f 100644 --- a/src/filedata.c +++ b/src/filedata.c @@ -829,8 +829,8 @@ static void filelist_recursive_append(GList **list, GList *dirs) { FileData *fd = (FileData *)(work->data); const gchar *path = fd->path; - GList *f = NULL; - GList *d = NULL; + GList *f; + GList *d; if (filelist_read(path, &f, &d)) { @@ -850,8 +850,8 @@ static void filelist_recursive_append(GList **list, GList *dirs) GList *filelist_recursive(const gchar *path) { - GList *list = NULL; - GList *d = NULL; + GList *list; + GList *d; if (!filelist_read(path, &list, &d)) return NULL; list = filelist_filter(list, FALSE); diff --git a/src/img-view.c b/src/img-view.c index e0a74a27..419e6c03 100644 --- a/src/img-view.c +++ b/src/img-view.c @@ -937,6 +937,8 @@ static void view_window_collection_unref_cb(GtkWidget *widget, gpointer data) void view_window_new(FileData *fd) { + GList *list; + if (file_extension_match(fd->path, ".gqv")) { ViewWindow *vw; @@ -961,15 +963,10 @@ void view_window_new(FileData *fd) G_CALLBACK(view_window_collection_unref_cb), cd); } } - else if (isdir(fd->path)) - { - GList *list = NULL; - - if (filelist_read(fd->path, &list, NULL)) - { - list = filelist_sort_path(list); - list = filelist_filter(list, FALSE); - } + else if (isdir(fd->path) && filelist_read(fd->path, &list, NULL)) + { + list = filelist_sort_path(list); + list = filelist_filter(list, FALSE); real_view_window_new(NULL, list, NULL, NULL); filelist_free(list); } diff --git a/src/main.c b/src/main.c index 5073c81c..6c22edcc 100644 --- a/src/main.c +++ b/src/main.c @@ -195,7 +195,7 @@ static void parse_command_line_add_file(const gchar *file_path, gchar **path, gc static void parse_command_line_add_dir(const gchar *dir, gchar **path, gchar **file, GList **list) { - GList *files = NULL; + GList *files; gchar *path_parsed; path_parsed = g_strdup(dir); diff --git a/src/pan-util.c b/src/pan-util.c index ef95e52d..e38af8c6 100644 --- a/src/pan-util.c +++ b/src/pan-util.c @@ -211,8 +211,8 @@ gint pan_is_ignored(const gchar *s, gint ignore_symlinks) GList *pan_list_tree(const gchar *path, SortType sort, gint ascend, gint ignore_symlinks) { - GList *flist = NULL; - GList *dlist = NULL; + GList *flist; + GList *dlist; GList *result; GList *folders; diff --git a/src/utilops.c b/src/utilops.c index d8e8aa54..f3bc22b5 100644 --- a/src/utilops.c +++ b/src/utilops.c @@ -1522,8 +1522,8 @@ void file_util_start_filter_from_filelist(gint n, GList *list, const gchar *dest FileData *file_util_delete_dir_empty_path(FileData *fd, gint real_content, gint level) { - GList *dlist = NULL; - GList *flist = NULL; + GList *dlist; + GList *flist; GList *work; FileData *fail = NULL; @@ -1690,8 +1690,8 @@ static GList *file_util_delete_dir_remaining_folders(GList *dlist) void file_util_delete_dir(FileData *fd, GtkWidget *parent) { - GList *dlist = NULL; - GList *flist = NULL; + GList *dlist; + GList *flist; GList *rlist; if (!isdir(fd->path)) return; diff --git a/src/view_dir_list.c b/src/view_dir_list.c index 3e943f1d..c17bdc69 100644 --- a/src/view_dir_list.c +++ b/src/view_dir_list.c @@ -219,10 +219,8 @@ gint vdlist_set_path(ViewDir *vd, const gchar *path) vd->path = g_strdup(path); filelist_free(VDLIST_INFO(vd, list)); - VDLIST_INFO(vd, list) = NULL; ret = filelist_read(vd->path, NULL, &VDLIST_INFO(vd, list)); - VDLIST_INFO(vd, list) = filelist_sort(VDLIST_INFO(vd, list), SORT_NAME, TRUE); /* add . and .. */ diff --git a/src/view_dir_tree.c b/src/view_dir_tree.c index 89f40fc3..9bc281d9 100644 --- a/src/view_dir_tree.c +++ b/src/view_dir_tree.c @@ -452,7 +452,6 @@ static gint vdtree_populate_path_by_iter(ViewDir *vd, GtkTreeIter *iter, gint fo vdtree_busy_push(vd); - list = NULL; filelist_read(nd->fd->path, NULL, &list); /* when hidden files are not enabled, and the user enters a hidden path, diff --git a/src/view_file_list.c b/src/view_file_list.c index 52c9da5f..6f2dbe61 100644 --- a/src/view_file_list.c +++ b/src/view_file_list.c @@ -1564,10 +1564,10 @@ gint vflist_refresh(ViewFile *vf) if (vf->path) { ret = filelist_read(vf->path, &vf->list, NULL); - } - DEBUG_1("%s vflist_refresh: sort", get_exec_time()); - vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend); + DEBUG_1("%s vflist_refresh: sort", get_exec_time()); + vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend); + } DEBUG_1("%s vflist_refresh: populate view", get_exec_time()); -- 2.20.1