From: Jeff King Date: Fri, 26 May 2017 19:07:42 +0000 (-0400) Subject: check_filename(): use skip_prefix X-Git-Tag: v2.14.0-rc0~89^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d51c6ee0d4bbeaf28bcd6c5f1681d208ee75763d?hp=--cc 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 Signed-off-by: Junio C Hamano --- d51c6ee0d4bbeaf28bcd6c5f1681d208ee75763d diff --git a/setup.c b/setup.c index 000ffa810e..f2a8070bd4 100644 --- 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; }