check_filename(): use skip_prefix
This avoids some magic numbers (and we'll be adding more similar calls in a minute). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
May 26, 2017 at 15:07 UTC
d51c6ee0d4bbeaf28bcd6c5f1681d208ee75763d
1 file changed
+2
-3
setup.c
+2
-3
@@ -137,10 +137,9 @@ int check_filename(const char *prefix, const char *arg)
137
char *to_free = NULL;
138
struct stat st;
139
140
- if (starts_with(arg, ":/")) {
141
- if (arg[2] == '\0') /* ":/" is root dir, always exists */
140
+ if (skip_prefix(arg, ":/", &arg)) {
141
+ if (!*arg) /* ":/" is root dir, always exists */
142
return 1;
143
- arg += 2;
143
prefix = NULL;
144
}
145