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>
This commit is contained in:
Jeff King 2017-05-26 15:07:42 -04:00 committed by Junio C Hamano
parent a08cbcda17
commit d51c6ee0d4

View File

@ -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;
}