check_filename(): use skip_prefix
authorJeff King <redacted>
Fri, 26 May 2017 19:07:42 +0000 (15:07 -0400)
committerJunio C Hamano <redacted>
Mon, 29 May 2017 02:36:56 +0000 (11:36 +0900)
This avoids some magic numbers (and we'll be adding more
similar calls in a minute).

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
setup.c

diff --git a/setup.c b/setup.c
index 000ffa810e1d24f78989f3a720c32724122ffd47..f2a8070bd4d9c9fb0117f87fdadc208d86e07e2b 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -137,10 +137,9 @@ int check_filename(const char *prefix, const char *arg)
        char *to_free = NULL;
        struct stat st;
 
-       if (starts_with(arg, ":/")) {
-               if (arg[2] == '\0') /* ":/" is root dir, always exists */
+       if (skip_prefix(arg, ":/", &arg)) {
+               if (!*arg) /* ":/" is root dir, always exists */
                        return 1;
-               arg += 2;
                prefix = NULL;
        }
 
git clone https://git.99rst.org/PROJECT