Drop initialization to NULL since filelist_read() will take care of it.
authorLaurent Monin <geeqie@norz.org>
Tue, 3 Jun 2008 11:24:16 +0000 (11:24 +0000)
committerLaurent Monin <geeqie@norz.org>
Tue, 3 Jun 2008 11:24:16 +0000 (11:24 +0000)
13 files changed:
src/bar_sort.c
src/cache_maint.c
src/collect-io.c
src/collect-table.c
src/dupe.c
src/filedata.c
src/img-view.c
src/main.c
src/pan-util.c
src/utilops.c
src/view_dir_list.c
src/view_dir_tree.c
src/view_file_list.c

index f891d64..1d4c345 100644 (file)
@@ -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);
index b6df9fd..81bb15a 100644 (file)
@@ -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);
index f11e273..29e2560 100644 (file)
@@ -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;
 
index 047119c..ca0a757 100644 (file)
@@ -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))
index 6551f46..9e73c7e 100644 (file)
@@ -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);
index 04d6dc2..78afa87 100644 (file)
@@ -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);
index e0a74a2..419e6c0 100644 (file)
@@ -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);
                }
index 5073c81..6c22edc 100644 (file)
@@ -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);
index ef95e52..e38af8c 100644 (file)
@@ -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;
 
index d8e8aa5..f3bc22b 100644 (file)
@@ -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;
index 3e943f1..c17bdc6 100644 (file)
@@ -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 .. */
index 89f40fc..9bc281d 100644 (file)
@@ -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,
index 52c9da5..6f2dbe6 100644 (file)
@@ -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());