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

Re: [PATCH 2/3] Convert hash functions to char instead of struct object

From
Junio C Hamano <gitster@pobox.com>
Date
May 19, 2009, 07:04 UTC
Message-ID
<7vk54d8tfx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4A12507A.3050307@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 7 quoted lines
> Dan McGee schrieb:
>> -static unsigned int hash_obj(struct object *obj, unsigned int n)
>> +static unsigned int hash_chars(const unsigned char *c, unsigned int n)
>
> hash_chars suggests that this function hashes arbitrary character
> sequences, but it doesn't do that. Wouldn't hash_object_id be a better
> name? (And the parameter would then obviously be named sha1 or id.)

Yes, the parameter to this function is what we call "unsigned char *sha1" everywhere else in the code. hash-object-id or hash-object-name is a good name for the function.

Previous: Johannes SixtNext: Johannes Schindelin
Message 8 of 9 in “Fix type-punning issues”
  1. Fix type-punning issuesDan McGee, May 12, 2009
  2. Junio C HamanoMay 12, 2009
  3. Dan McGeeMay 19, 2009
  4. 1/3 Unify signedness in hashing callsDan McGee, May 19, 2009
  5. 2/3 Convert hash functions to char instead of struct objectDan McGee, May 19, 2009
  6. 3/3 Unify sha1 char hash functionsDan McGee, May 19, 2009
  7. Johannes SixtMay 19, 2009
  8. Junio C HamanoMay 19, 2009
  9. Johannes SchindelinMay 12, 2009

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.