From: Junio C Hamano Date: Fri, 20 Jun 2014 17:15:27 GMT Subject: Re: [PATCH v5 2/2] cleanup duplicate name_compare() functions Message-ID: In-Reply-To: <1403230004-11034-3-git-send-email-jmmahler@gmail.com> Jeremiah Mahler writes: > We often represent our strings as a counted string, i.e. a pair of the > pointer to the beginning of the string and its length, and the string > may not be NUL terminated to that length. > > To compare a pair of such counted strings, unpack-trees.c and > read-cache.c implement their own name_compare() functions identically. > In addition, the cache_name_compare() function in read-cache.c is nearly > identical. The only difference is when one string is the prefix of the > other string, in which case the former returns -1/+1 to show which one > is longer and the latter returns the difference of the lengths to show > the same information. I think I got the former/latter swapped by mistake when I wrote this (two name_compare() give us the difference, and cache_name_compare() gives -1/+1); I'll spell their names out when I queue this patch. Thanks.