From fcc8639169ea56444c2a706bff82aaea2262aa4a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 25 Aug 2019 12:31:28 +0300 Subject: [PATCH] (handle_path): change parameters type from int* to gboolean*. (do_find): change variable type and reduce scope. (do_external_panelize): change variable type. Signed-off-by: Andrew Borodin --- src/filemanager/dir.c | 8 ++++---- src/filemanager/dir.h | 3 ++- src/filemanager/find.c | 6 +++--- src/filemanager/panelize.c | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c index 8753991ae..1d72cf1fe 100644 --- a/src/filemanager/dir.c +++ b/src/filemanager/dir.c @@ -583,7 +583,7 @@ dir_list_init (dir_list * list) /* Return values: FALSE = don't add, TRUE = add to the list */ gboolean -handle_path (const char *path, struct stat * buf1, int *link_to_dir, int *stale_link) +handle_path (const char *path, struct stat * buf1, gboolean * link_to_dir, gboolean * stale_link) { vfs_path_t *vpath; @@ -601,8 +601,8 @@ handle_path (const char *path, struct stat * buf1, int *link_to_dir, int *stale_ tree_store_mark_checked (path); /* A link to a file or a directory? */ - *link_to_dir = 0; - *stale_link = 0; + *link_to_dir = FALSE; + *stale_link = FALSE; if (S_ISLNK (buf1->st_mode)) { struct stat buf2; @@ -610,7 +610,7 @@ handle_path (const char *path, struct stat * buf1, int *link_to_dir, int *stale_ if (mc_stat (vpath, &buf2) == 0) *link_to_dir = S_ISDIR (buf2.st_mode) != 0; else - *stale_link = 1; + *stale_link = TRUE; } vfs_path_free (vpath); diff --git a/src/filemanager/dir.h b/src/filemanager/dir.h index f04065e68..b41b51fa7 100644 --- a/src/filemanager/dir.h +++ b/src/filemanager/dir.h @@ -56,7 +56,8 @@ void dir_list_sort (dir_list * list, GCompareFunc sort, const dir_sort_options_t gboolean dir_list_init (dir_list * list); void dir_list_clean (dir_list * list); void dir_list_free_list (dir_list * list); -gboolean handle_path (const char *path, struct stat *buf1, int *link_to_dir, int *stale_link); +gboolean handle_path (const char *path, struct stat *buf1, gboolean * link_to_dir, + gboolean * stale_link); /* Sorting functions */ int unsorted (file_entry_t * a, file_entry_t * b); diff --git a/src/filemanager/find.c b/src/filemanager/find.c index c66278e19..6cdfb5766 100644 --- a/src/filemanager/find.c +++ b/src/filemanager/find.c @@ -1773,7 +1773,6 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs, if (return_value == B_PANELIZE && *filename) { - int link_to_dir, stale_link; int i; struct stat st; GList *entry; @@ -1790,6 +1789,7 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs, WLEntry *le = LENTRY (entry->data); find_match_location_t *location = le->data; char *p; + gboolean link_to_dir, stale_link; if ((le->text == NULL) || (location == NULL) || (location->dir == NULL)) continue; @@ -1833,8 +1833,8 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs, list->list[list->len].fnamelen = strlen (p); list->list[list->len].fname = g_strndup (p, list->list[list->len].fnamelen); list->list[list->len].f.marked = 0; - list->list[list->len].f.link_to_dir = link_to_dir; - list->list[list->len].f.stale_link = stale_link; + list->list[list->len].f.link_to_dir = link_to_dir ? 1 : 0; + list->list[list->len].f.stale_link = stale_link ? 1 : 0; list->list[list->len].f.dir_size_computed = 0; list->list[list->len].st = st; list->list[list->len].sort_key = NULL; diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c index 0564d84c9..5ea782837 100644 --- a/src/filemanager/panelize.c +++ b/src/filemanager/panelize.c @@ -321,7 +321,7 @@ do_external_panelize (char *command) char line[MC_MAXPATHLEN]; size_t len; char *name; - int link_to_dir, stale_link; + gboolean link_to_dir, stale_link; struct stat st; clearerr (external); @@ -345,7 +345,7 @@ do_external_panelize (char *command) if (!handle_path (name, &st, &link_to_dir, &stale_link)) continue; - if (!dir_list_append (list, name, &st, link_to_dir != 0, stale_link != 0)) + if (!dir_list_append (list, name, &st, link_to_dir, stale_link)) break; file_mark (current_panel, list->len - 1, 0);