commit 929e1b68098d14c3143910eb4353acc33b9f6f20 parent d3f0d32e162cbfa5ed89c0644873c68ce96184f0 Author: Benno Schulenberg <bensberg@telfort.nl> Date: Mon, 19 Nov 2018 16:38:54 +0100 tweaks: rename a parameter plus a variable, and reshuffle an assignment Also improve the comment. Diffstat:
M | src/files.c | | | 12 | +++++------- |
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/files.c b/src/files.c @@ -2417,18 +2417,16 @@ int diralphasort(const void *va, const void *vb) #endif #ifdef ENABLE_TABCOMP -/* Is the given path a directory? */ -bool is_dir(const char *buf) +/* Return TRUE when the given path is a directory. */ +bool is_dir(const char *path) { - char *dirptr; + char *realpath = real_dir_from_tilde(path); struct stat fileinfo; bool retval; - dirptr = real_dir_from_tilde(buf); + retval = (stat(realpath, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode)); - retval = (stat(dirptr, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode)); - - free(dirptr); + free(realpath); return retval; }