]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Implement is_full_path() helper function
authorRamiro Polla <ramiro.polla@gmail.com>
Fri, 16 Jul 2010 19:54:14 +0000 (16:54 -0300)
committerRamiro Polla <ramiro.polla@gmail.com>
Fri, 16 Jul 2010 19:54:14 +0000 (16:54 -0300)
ccache.c
ccache.h
util.c

index 2741c4eac78757b0d5001bb5886994f773eb7581..7acde89f687c852b104f56b6732ad6254161e0f2 100644 (file)
--- 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;
                }
index d416c3e734f720bc0cb2069f083cd5ac9a1c85ac..92247326cac84a57c623e94ad6d03e6619c2136c 100644 (file)
--- 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 2f691cc6d262f6ed6db9297c6749af7e1998a44f..de87746a3f7e7e841e15af23309a4e2362b38f90 100644 (file)
--- 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.