(canonicalize_pathname): make inline.

(canonicalize_pathname_custom): fix description.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-11-13 15:23:04 +03:00
parent e42012d51e
commit e6cccfbd82
2 changed files with 24 additions and 23 deletions

View File

@ -234,7 +234,6 @@ void save_stop_handler (void);
char *tilde_expand (const char *directory);
void canonicalize_pathname_custom (char *path, canon_path_flags_t flags);
void canonicalize_pathname (char *path);
char *mc_realpath (const char *path, char *resolved_path);
@ -279,7 +278,9 @@ void mc_replace_error (GError ** dest, int code, const char *format, ...) G_GNUC
gboolean mc_time_elapsed (gint64 * timestamp, gint64 delay);
/*** inline functions **************************************************/
/* --------------------------------------------------------------------------------------------- */
/*** inline functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static inline gboolean
exist_file (const char *name)
@ -287,10 +288,31 @@ exist_file (const char *name)
return (access (name, R_OK) == 0);
}
/* --------------------------------------------------------------------------------------------- */
static inline gboolean
is_exe (mode_t mode)
{
return ((mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Canonicalize path with CANON_PATH_ALL.
*
* @param path path to file
* @param flags canonicalization flags
*
* All modifications of @path are made in place.
* Well formed UNC paths are modified only in the local part.
*/
static inline void
canonicalize_pathname (char *path)
{
canonicalize_pathname_custom (path, CANON_PATH_ALL);
}
/* --------------------------------------------------------------------------------------------- */
#endif /* MC_UTIL_H */

View File

@ -759,8 +759,6 @@ tilde_expand (const char *directory)
* @param path path to file
* @param flags canonicalization flags
*
* @return a new path
*
* All modifications of @path are made in place.
* Well formed UNC paths are modified only in the local part.
*/
@ -986,25 +984,6 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
}
}
/* --------------------------------------------------------------------------------------------- */
/**
* Canonicalize path with CANON_PATH_ALL.
*
* @param path path to file
* @param flags canonicalization flags
*
* @return a new path
*
* All modifications of @path are made in place.
* Well formed UNC paths are modified only in the local part.
*/
void
canonicalize_pathname (char *path)
{
canonicalize_pathname_custom (path, CANON_PATH_ALL);
}
/* --------------------------------------------------------------------------------------------- */
char *