Re: [PATCH v5 2/2] cleanup duplicate name_compare() functions
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 20, 2014, 17:15 UTC
- Message-ID
- <xmqqpphw7k4y.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1403230004-11034-3-git-send-email-jmmahler@gmail.com>
Jeremiah Mahler <jmmahler@gmail.com> writes:
Show 11 quoted lines
> 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.