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

Re: [PATCH] Define constants for lengths of object names

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 1, 2014, 18:23 UTC
Message-ID
<20140501182304.GB9218@google.com>
In-Reply-To
<20140501172007.GZ9218@google.com>
Jonathan Nieder wrote:
> brian m. carlson wrote:
Show 13 quoted lines
>> --- a/object.h
>> +++ b/object.h
> [...]
>> @@ -49,7 +56,7 @@ struct object {
>>  	unsigned used : 1;
>>  	unsigned type : TYPE_BITS;
>>  	unsigned flags : FLAG_BITS;
>> -	unsigned char sha1[20];
>> +	unsigned char sha1[GIT_OID_RAWSZ];
>
> Maybe my brain has been damaged by reading code from too many C
> projects that hard-code some constants, but I find '20' easier to read
> here.
That said, RAW_SHA1_BYTES would sound okay to me.
Part of the problem was how long it takes to mentally parse oid_rawsz.

Thanks, Jonathan

Previous: Jonathan NiederNext: brian m. carlson
Message 3 of 7 in “Define constants for lengths of object names”
  1. Define constants for lengths of object namesbrian m. carlson, May 1, 2014
  2. Jonathan NiederMay 1, 2014
  3. Jonathan NiederMay 1, 2014
  4. brian m. carlsonMay 1, 2014
  5. Jonathan NiederMay 1, 2014
  6. Duy NguyenMay 2, 2014
  7. brian m. carlsonMay 2, 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.