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

Re: [PATCH v4] Replace memcpy with hashcpy when dealing hash copy globally

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 6, 2014, 19:32 UTC
Message-ID
<xmqqpplzxgv4.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1394097084-3129-1-git-send-email-sunheehnus@gmail.com>
Sun He <sunheehnus@gmail.com> writes:
> hashcpy() can keep the abstraction of "object name" behind it.

Do we really want to change the phrasing you took the above from to say "*can* keep"?

Providing the "object name" abstraction is the whole point of the function, so of course it can keep it, but that goes without saying---it was the sole reason why it was invented in the first place.

> Use it instead of memcpy() with hard-coded 20-byte length when
> moving object names between pieces of memory.
> We can benefit from it, when we switch to another hash algorithm,
> eg. MD5, by just fixing the hashcpy().

"fix" can be used in two scenarios, I think. Something is broken and you fix it, or something keeps changing and you force it not to change. I do not think either applies to hashcpy(). Perhaps "updating", if we really wanted to say it, but because this change is not about preparing us to any planned switch of hash function, I'd suggest dropping those two lines starting from "We can benefit from...".

> Leave ppc/sha1.c as it is, because the function is about the
> SHA-1 hash algorithm whose output is and will always be 20-byte.
Correct.
Previous: Sun He
Message 2 of 2 in “Replace memcpy with hashcpy when dealing hash copy globally”
  1. Replace memcpy with hashcpy when dealing hash copy globallySun He, Mar 6, 2014
  2. Junio C HamanoMar 6, 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.