From: Ramiro Polla Date: Fri, 16 Jul 2010 19:54:14 +0000 (-0300) Subject: Implement is_full_path() helper function X-Git-Tag: v3.1~167^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a442eb97bf6682452b2be09a0015deef37a75cb;p=thirdparty%2Fccache.git Implement is_full_path() helper function --- diff --git a/ccache.c b/ccache.c index 2741c4eac..7acde89f6 100644 --- a/ccache.c +++ b/ccache.c @@ -1266,7 +1266,7 @@ static void find_compiler(int argc, char **argv) if (compare_executable_name(base, MYNAME)) { args_remove_first(orig_args); free(base); - if (strchr(argv[1],'/')) { + if (is_full_path(argv[1])) { /* a full path was given */ return; } diff --git a/ccache.h b/ccache.h index d416c3e73..92247326c 100644 --- a/ccache.h +++ b/ccache.h @@ -109,6 +109,7 @@ int compare_executable_name(const char *s1, const char *s2); size_t common_dir_prefix_length(const char *s1, const char *s2); char *get_relative_path(const char *from, const char *to); int is_absolute_path(const char *path); +int is_full_path(const char *path); void update_mtime(const char *path); void *x_fmmap(const char *fname, off_t *size, const char *errstr); int x_munmap(void *addr, size_t length); diff --git a/util.c b/util.c index 2f691cc6d..de87746a3 100644 --- a/util.c +++ b/util.c @@ -959,6 +959,17 @@ is_absolute_path(const char *path) return path[0] == '/'; } +/* + * Return whether the argument is a full path. + */ +int +is_full_path(const char *path) +{ + if (strchr(path, '/')) + return 1; + return 0; +} + /* * Update the modification time of a file in the cache to save it from LRU * cleanup.