Re: [PATCH] Define constants for lengths of object names
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- May 1, 2014, 23:00 UTC
- Message-ID
- <20140501230041.GC75770@vauxhall.crustytoothpaste.net>
- In-Reply-To
- <20140501172007.GZ9218@google.com>
On Thu, May 01, 2014 at 10:20:07AM -0700, Jonathan Nieder wrote:
Show 32 quoted lines
> Hi,
>
> brian m. carlson wrote:
>
> > --- 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.
>
> What happened to the
>
> struct object_id {
> unsigned char id[20];
> };
>
> ...
>
> struct object {
> ...
> struct object_id id;
> };
>
> idea?There didn't seem to be a huge amount of support for it. Also, there were concerns that some architectures might impose alignment constraints on it that made sizeof(struct object_id) != 20.
-- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187