From: Junio C Hamano Date: Tue, 15 Jun 2010 22:12:29 GMT Subject: Re: [PATCH] common_prefix: be more careful about pathspec bounds Message-ID: <7vaaqwgd2q.fsf@alter.siamese.dyndns.org> In-Reply-To: <201006152004.01507.trast@student.ethz.ch> Thomas Rast 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 ;-) > > 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. Perhaps..