Re: [PATCH] general style: replaces memcmp() with starts_with()
- From
Jens Lehmann <jens.lehmann@web.de>
- Date
- Mar 12, 2014, 17:22 UTC
- Message-ID
- <532097D0.4070909@web.de>
- In-Reply-To
- <CALs4jVFpr=YVAagJSEkAJ6qGJmYWNdu4ZXXvMYQRd0KYQXcVQA@mail.gmail.com>
Am 12.03.2014 17:46, schrieb Quint Guvernator:
Show 8 quoted lines
> 2014-03-12 11:47 GMT-04:00 Jens Lehmann <Jens.Lehmann@web.de>: >> I think this hunk should be dropped as the memcmp() here doesn't mean >> "starts with" but "is identical" (due to the "ce_namelen(ce) == 11" in >> the line above). > > There is an issue with negation in this patch. I've submitted a new > one [1] to the mailing list. The subject line of the new patch is > "[PATCH] general style: replaces memcmp() with proper starts_with()".
Thanks, I missed that one (please use "[PATCH v2]" in the subject line of a second patch to make follow-ups easily distinguishable from the initial one ;-).
> 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.
> [1]: http://thread.gmane.org/gmane.comp.version-control.git/243940