Thread (5 messages) flat view 5 messages, 2 authors, 2016-06-15

Re: [PATCH v5 2/2] cleanup duplicate name_compare() functions

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:01:44

Jeremiah Mahler [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help