Re: [PATCH] common_prefix: be more careful about pathspec bounds
Thomas Rast <trast@student.ethz.ch> writes:
> I really didn't like the two-interleaved-loops version in your last
> mail, but this one is way more readable than even the original.
>
> (Why did you wrap the for loop? It's only 76 chars.)
Because I was writing it in my MUA ;-)
Show 11 quoted lines
>
> Maybe you could add a comment like
>
>> slash = strrchr(path, '/');
>> if (!slash)
>> return 0;
> /* The first 'prefix' characters of 'path' always include the
> trailing slash of the prefix directory */
>> prefix = slash - path + 1;
>
> to clean up any doubts about the correctness of the matching.