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

2014-05-02 Thread brian m. carlson
On Fri, May 02, 2014 at 07:15:44AM +0700, Duy Nguyen wrote: On Fri, May 2, 2014 at 6:05 AM, Jonathan Nieder jrnie...@gmail.com wrote: I can make up for it in enthuasiasm. Please? It's something I've wanted for a long time but never found the time to do. It's definitely better in the

[PATCH] Define constants for lengths of object names

2014-05-01 Thread brian m. carlson
Using preprocessor constants rather than hardcoded numbers is considered a good programming practice. Provide two constants, GIT_OID_RAWSZ and GIT_OID_HEXSZ, which are the lengths of an SHA-1 object name in bytes and hex digits, respectively. These names are the same as those used by libgit2.

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

2014-05-01 Thread Jonathan Nieder
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

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

2014-05-01 Thread Jonathan Nieder
Jonathan Nieder wrote: 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

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

2014-05-01 Thread brian m. carlson
On Thu, May 01, 2014 at 10:20:07AM -0700, Jonathan Nieder wrote: 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];

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

2014-05-01 Thread Jonathan Nieder
brian m. carlson wrote: On Thu, May 01, 2014 at 10:20:07AM -0700, Jonathan Nieder wrote: What happened to the struct object_id { unsigned char id[20]; }; ... struct object { ... struct object_id id; }; idea? There

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

2014-05-01 Thread Duy Nguyen
On Fri, May 2, 2014 at 6:05 AM, Jonathan Nieder jrnie...@gmail.com wrote: brian m. carlson wrote: On Thu, May 01, 2014 at 10:20:07AM -0700, Jonathan Nieder wrote: What happened to the struct object_id { unsigned char id[20]; }; ... struct object {