static int
dumpdir_cmp (const char *a, const char *b)
{
- size_t len;
-
while (*a)
switch (*a)
{
case 'Y':
case 'N':
- if (!strchr ("YN", *b))
- return 1;
- if (strcmp(a + 1, b + 1))
+ /* If the null-terminated strings A and B are equal, other
+ than possibly A's first byte being 'Y' where B's is 'N' or
+ vice versa, advance A and B past the strings.
+ Otherwise, return 1. */
+ if (! (*b == 'Y' || *b == 'N'))
return 1;
- len = strlen (a) + 1;
- a += len;
- b += len;
- break;
-
+ a++, b++;
+ FALLTHROUGH;
case 'D':
- if (strcmp(a, b))
+ /* If the null-terminated strings A and B are equal, advance A
+ and B past them. Otherwise, return 1. */
+ while (*a)
+ if (*a++ != *b++)
+ return 1;
+ if (*b)
return 1;
- len = strlen (a) + 1;
- a += len;
- b += len;
+ a++, b++;
break;
case 'R':
case 'T':
case 'X':
return *b;
+
+ default:
+ unreachable ();
}
return *b;
}