git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Jeremiah Mahler
Message 5 of 5 in “cleanup duplicate name_compare() functions”
  1. 0/2 cleanup duplicate name_compare() functionsJeremiah Mahler, Jun 20, 2014
  2. 1/2 name-hash.c: replace cache_name_compare() with memcmp()Jeremiah Mahler, Jun 20, 2014
  3. Junio C HamanoJun 20, 2014
  4. 2/2 cleanup duplicate name_compare() functionsJeremiah Mahler, Jun 20, 2014
  5. Junio C HamanoJun 20, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.