if_link_is_exe() and link_is_dir() now return gboolean

...and link_is_dir() is inline now.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-11-11 16:09:08 +03:00
parent 50c128a01f
commit 141926344d
2 changed files with 11 additions and 18 deletions

View File

@ -573,30 +573,17 @@ do_load_dir (const char *path, dir_list * list, sortfn * sort, int lc_reverse,
return next_free; return next_free;
} }
/* --------------------------------------------------------------------------------------------- */
int
link_isdir (const file_entry * file)
{
if (file->f.link_to_dir)
return 1;
else
return 0;
}
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
int gboolean
if_link_is_exe (const char *full_name, const file_entry * file) if_link_is_exe (const char *full_name, const file_entry * file)
{ {
struct stat b; struct stat b;
if (S_ISLNK (file->st.st_mode) && !mc_stat (full_name, &b)) if (S_ISLNK (file->st.st_mode) && mc_stat (full_name, &b) == 0)
{
return is_exe (b.st_mode); return is_exe (b.st_mode);
} return TRUE;
else
return 1;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

View File

@ -74,8 +74,14 @@ int sort_ctime (file_entry * a, file_entry * b);
int sort_size (file_entry * a, file_entry * b); int sort_size (file_entry * a, file_entry * b);
int sort_inode (file_entry * a, file_entry * b); int sort_inode (file_entry * a, file_entry * b);
int link_isdir (const file_entry *); gboolean if_link_is_exe (const char *full_name, const file_entry * file);
int if_link_is_exe (const char *full_name, const file_entry * file);
/*** inline functions ****************************************************************************/ /*** inline functions ****************************************************************************/
static inline gboolean
link_isdir (const file_entry *file)
{
return (gboolean) file->f.link_to_dir;
}
#endif /* MC__DIR_H */ #endif /* MC__DIR_H */