From: Junio C Hamano <gitster@pobox•com>
To: Jeremiah Mahler <jmmahler@gmail•com>
Cc: Jonathan Nieder <jrnieder@gmail•com>, git@vger•kernel.org
Subject: Re: [PATCH v5 2/2] cleanup duplicate name_compare() functions
Date: Fri, 20 Jun 2014 10:15:27 -0700 [thread overview]
Message-ID: <xmqqpphw7k4y.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: 1403230004-11034-3-git-send-email-jmmahler@gmail.com
Jeremiah Mahler <jmmahler@gmail•com> 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.
prev parent reply other threads:[~2014-06-25 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 2:06 [PATCH v5 0/2] cleanup duplicate name_compare() functions Jeremiah Mahler
2014-06-20 2:06 ` [PATCH v5 1/2] name-hash.c: replace cache_name_compare() with memcmp() Jeremiah Mahler
2014-06-20 17:10 ` Junio C Hamano
2014-06-20 2:06 ` [PATCH v5 2/2] cleanup duplicate name_compare() functions Jeremiah Mahler
2014-06-20 17:15 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqpphw7k4y.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=jmmahler@gmail$(echo .)com \
--cc=jrnieder@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox