Browse Source

verify_path: drop clever fallthrough

We check ".git" and ".." in the same switch statement, and
fall through the cases to share the end-of-component check.
While this saves us a line or two, it makes modifying the
function much harder. Let's just write it out.

Signed-off-by: Jeff King <peff@peff.net>
maint
Jeff King 7 years ago
parent
commit
e19e5e66d6
  1. 8
      read-cache.c

8
read-cache.c

@ -810,8 +810,7 @@ static int verify_dotfile(const char *rest)


switch (*rest) { switch (*rest) {
/* /*
* ".git" followed by NUL or slash is bad. This * ".git" followed by NUL or slash is bad.
* shares the path end test with the ".." case.
*/ */
case 'g': case 'g':
case 'G': case 'G':
@ -819,8 +818,9 @@ static int verify_dotfile(const char *rest)
break; break;
if (rest[2] != 't' && rest[2] != 'T') if (rest[2] != 't' && rest[2] != 'T')
break; break;
rest += 2; if (rest[3] == '\0' || is_dir_sep(rest[3]))
/* fallthrough */ return 0;
break;
case '.': case '.':
if (rest[1] == '\0' || is_dir_sep(rest[1])) if (rest[1] == '\0' || is_dir_sep(rest[1]))
return 0; return 0;

Loading…
Cancel
Save