summaryrefslogtreecommitdiff
path: root/src/file.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2022-10-17 23:36:36 -0400
committerPaul Smith <psmith@gnu.org>2022-10-18 14:20:44 -0400
commit7bb7bb4ba49967e71abf14d7d59036b9a0eddf93 (patch)
tree2895b178787d4028941a4ef116ec4365ac5f8b24 /src/file.c
parentb79791533bf2a784bf201fbb9f63588ef24fc404 (diff)
downloadmake-git-7bb7bb4ba49967e71abf14d7d59036b9a0eddf93.tar.gz
Add ISDIRSEP() helper macro and use it
Create a ISDIRSEP() macro to check for directory separator chars using the stopchar_map, and replace inline checks and explicit STOP_SET calls with this macro. * src/makeint.h (ISDIRSEP): Create the macro using MAP_DIRSEP. * src/dir.c (find_directory): Replace inline checks with ISDIRSEP. (file_exists_p): Ditto. (file_impossible): Ditto. (file_impossible_p): Ditto. (local_stat): Ditto. * src/file.c (lookup_file): Ditto. * src/function.c (abspath): Ditto. * src/job.c (_is_unixy_shell): Ditto. (is_bourne_compatible_shell): Ditto. (construct_command_argv): Ditto. * src/main.c (find_and_set_default_shell): Ditto. (main): Ditto. * src/read.c (eval): Ditto. (parse_file_seq): Ditto. * src/remake.c (name_mtime): Ditto. * src/vpath.c (construct_vpath_list): Ditto.
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/file.c b/src/file.c
index 62b8dd00..d2ee2c68 100644
--- a/src/file.c
+++ b/src/file.c
@@ -108,20 +108,10 @@ lookup_file (const char *name)
while (name[0] == '<' && name[1] == '>' && name[2] != '\0')
name += 2;
#endif
- while (name[0] == '.'
-#ifdef HAVE_DOS_PATHS
- && (name[1] == '/' || name[1] == '\\')
-#else
- && name[1] == '/'
-#endif
- && name[2] != '\0')
+ while (name[0] == '.' && ISDIRSEP (name[1]) && name[2] != '\0')
{
name += 2;
- while (*name == '/'
-#ifdef HAVE_DOS_PATHS
- || *name == '\\'
-#endif
- )
+ while (ISDIRSEP (*name))
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
++name;
}