Jeff King <peff@xxxxxxxx> writes: > diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c > index 2d43278..772c668 100644 > --- a/builtin/mailsplit.c > +++ b/builtin/mailsplit.c > @@ -130,6 +130,26 @@ static int populate_maildir_list(struct string_list *list, const char *path) > return 0; > } > > +static int maildir_filename_cmp(const char *a, const char *b) > +{ > + while (1) { It is somewhat funny that we do not need to check !*a or !*b in this loop. As long as readdir() does not return duplicates, we won't be comparing the same strings with this function, and we won't read past '\0' at the end of both a and b at the same time. > + if (isdigit(*a) && isdigit(*b)) { > + long int na, nb; > + na = strtol(a, (char **)&a, 10); > + nb = strtol(b, (char **)&b, 10); > + if (na != nb) > + return na - nb; > + /* strtol advanced our pointers */ > + } > + else { > + if (*a != *b) > + return *a - *b; > + a++; > + b++; > + } > + } > +} -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html