mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
(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 <aborodin@vmail.ru>
This commit is contained in:
parent
ea0fcc0fb8
commit
fcc8639169
@ -583,7 +583,7 @@ dir_list_init (dir_list * list)
|
|||||||
/* Return values: FALSE = don't add, TRUE = add to the list */
|
/* Return values: FALSE = don't add, TRUE = add to the list */
|
||||||
|
|
||||||
gboolean
|
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;
|
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);
|
tree_store_mark_checked (path);
|
||||||
|
|
||||||
/* A link to a file or a directory? */
|
/* A link to a file or a directory? */
|
||||||
*link_to_dir = 0;
|
*link_to_dir = FALSE;
|
||||||
*stale_link = 0;
|
*stale_link = FALSE;
|
||||||
if (S_ISLNK (buf1->st_mode))
|
if (S_ISLNK (buf1->st_mode))
|
||||||
{
|
{
|
||||||
struct stat buf2;
|
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)
|
if (mc_stat (vpath, &buf2) == 0)
|
||||||
*link_to_dir = S_ISDIR (buf2.st_mode) != 0;
|
*link_to_dir = S_ISDIR (buf2.st_mode) != 0;
|
||||||
else
|
else
|
||||||
*stale_link = 1;
|
*stale_link = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfs_path_free (vpath);
|
vfs_path_free (vpath);
|
||||||
|
@ -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);
|
gboolean dir_list_init (dir_list * list);
|
||||||
void dir_list_clean (dir_list * list);
|
void dir_list_clean (dir_list * list);
|
||||||
void dir_list_free_list (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 */
|
/* Sorting functions */
|
||||||
int unsorted (file_entry_t * a, file_entry_t * b);
|
int unsorted (file_entry_t * a, file_entry_t * b);
|
||||||
|
@ -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)
|
if (return_value == B_PANELIZE && *filename)
|
||||||
{
|
{
|
||||||
int link_to_dir, stale_link;
|
|
||||||
int i;
|
int i;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
GList *entry;
|
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);
|
WLEntry *le = LENTRY (entry->data);
|
||||||
find_match_location_t *location = le->data;
|
find_match_location_t *location = le->data;
|
||||||
char *p;
|
char *p;
|
||||||
|
gboolean link_to_dir, stale_link;
|
||||||
|
|
||||||
if ((le->text == NULL) || (location == NULL) || (location->dir == NULL))
|
if ((le->text == NULL) || (location == NULL) || (location->dir == NULL))
|
||||||
continue;
|
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].fnamelen = strlen (p);
|
||||||
list->list[list->len].fname = g_strndup (p, list->list[list->len].fnamelen);
|
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.marked = 0;
|
||||||
list->list[list->len].f.link_to_dir = link_to_dir;
|
list->list[list->len].f.link_to_dir = link_to_dir ? 1 : 0;
|
||||||
list->list[list->len].f.stale_link = stale_link;
|
list->list[list->len].f.stale_link = stale_link ? 1 : 0;
|
||||||
list->list[list->len].f.dir_size_computed = 0;
|
list->list[list->len].f.dir_size_computed = 0;
|
||||||
list->list[list->len].st = st;
|
list->list[list->len].st = st;
|
||||||
list->list[list->len].sort_key = NULL;
|
list->list[list->len].sort_key = NULL;
|
||||||
|
@ -321,7 +321,7 @@ do_external_panelize (char *command)
|
|||||||
char line[MC_MAXPATHLEN];
|
char line[MC_MAXPATHLEN];
|
||||||
size_t len;
|
size_t len;
|
||||||
char *name;
|
char *name;
|
||||||
int link_to_dir, stale_link;
|
gboolean link_to_dir, stale_link;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
clearerr (external);
|
clearerr (external);
|
||||||
@ -345,7 +345,7 @@ do_external_panelize (char *command)
|
|||||||
if (!handle_path (name, &st, &link_to_dir, &stale_link))
|
if (!handle_path (name, &st, &link_to_dir, &stale_link))
|
||||||
continue;
|
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;
|
break;
|
||||||
|
|
||||||
file_mark (current_panel, list->len - 1, 0);
|
file_mark (current_panel, list->len - 1, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user