On Wed, Mar 12, 2014 at 06:22:24PM +0100, Jens Lehmann wrote: > > Let me know if you still think the hunk should be dropped there. > > Yes, I think so. That spot uses memcmp() because ce->name may > not be 0-terminated. If that assumption isn't correct, it should > be replaced with a plain strcmp() instead (while also dropping > the ce_namelen() comparison in the line above). But starts_with() > points into the wrong direction there. I think the length-check and memcmp is an optimization[1] here. But we should be able to encapsulate that pattern and avoid magic numbers entirely with something like mem_equals(). See my other response for more details. -Peff [1] Getting rid of the magic number entirely means we have to call strlen(".gitmodules"), which seems like it is working against this optimization. But I think past experiments have shown that decent compilers will optimize strlen on a string literal to a constant, so as long as mem_equals is an inline, it should be equivalent. -- 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