Code

prefix_path: use is_absolute_path() instead of *orig == '/'
authorJohannes Sixt <johannes.sixt@telecom.at>
Tue, 19 Feb 2008 21:29:40 +0000 (22:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Feb 2008 04:21:43 +0000 (20:21 -0800)
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c

diff --git a/setup.c b/setup.c
index bc80301c4239f1f101670cc623badb8bb694bd3d..dc247a84c49709d2bff00440e5ac976df83acd2e 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -91,7 +91,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
 {
        const char *orig = path;
        char *sanitized = xmalloc(len + strlen(path) + 1);
-       if (*orig == '/')
+       if (is_absolute_path(orig))
                strcpy(sanitized, path);
        else {
                if (len)
@@ -100,7 +100,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
        }
        if (sanitary_path_copy(sanitized, sanitized))
                goto error_out;
-       if (*orig == '/') {
+       if (is_absolute_path(orig)) {
                const char *work_tree = get_git_work_tree();
                size_t len = strlen(work_tree);
                size_t total = strlen(sanitized) + 1;