Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Michael Haggerty
On 06/05/2015 09:42 PM, brian m. carlson wrote: > On Fri, Jun 05, 2015 at 05:22:08PM +0200, Michael Haggerty wrote: >> I don't know that there would necessarily be problems, but I >> would worry about code involving structure assignment. For >> example, suppose the following snippet: >> >> void f(

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread brian m. carlson
On Fri, Jun 05, 2015 at 06:36:39AM -0400, Jeff King wrote: > On Fri, Jun 05, 2015 at 05:14:25PM +0700, Duy Nguyen wrote: > > > I'm more concerned about breaking object_id abstraction than C > > standard. Let's think a bit about future. I suppose we need to support > > both sha-1 and sha-512, at le

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread brian m. carlson
On Fri, Jun 05, 2015 at 05:22:08PM +0200, Michael Haggerty wrote: > I don't know that there would necessarily be problems, but I would worry > about code involving structure assignment. For example, suppose the > following snippet: > > void f(struct object_id *oid) > { > struct obj

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Junio C Hamano
Duy Nguyen writes: > I'm more concerned about breaking object_id abstraction than C > standard. Let's think a bit about future. I suppose we need to support > both sha-1 and sha-512, at least at the source code level. That might > make casting tricky. If we support both, the code that writes tod

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Michael Haggerty
On 06/05/2015 11:45 AM, Jeff King wrote: > On Fri, Jun 05, 2015 at 01:41:21AM +, brian m. carlson wrote: > >> However, with the object_id conversion, we run into a problem: casting >> those unsigned char * values into struct object_id * values is not >> allowed by the C standard. There are tw

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Duy Nguyen
On Fri, Jun 5, 2015 at 5:36 PM, Jeff King wrote: > On Fri, Jun 05, 2015 at 05:14:25PM +0700, Duy Nguyen wrote: > >> I'm more concerned about breaking object_id abstraction than C >> standard. Let's think a bit about future. I suppose we need to support >> both sha-1 and sha-512, at least at the so

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Jeff King
On Fri, Jun 05, 2015 at 05:14:25PM +0700, Duy Nguyen wrote: > I'm more concerned about breaking object_id abstraction than C > standard. Let's think a bit about future. I suppose we need to support > both sha-1 and sha-512, at least at the source code level. I think that's going to be a much bigg

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Duy Nguyen
On Fri, Jun 5, 2015 at 4:45 PM, Jeff King wrote: > On Fri, Jun 05, 2015 at 01:41:21AM +, brian m. carlson wrote: > >> However, with the object_id conversion, we run into a problem: casting >> those unsigned char * values into struct object_id * values is not >> allowed by the C standard. Ther

Re: Pack files, standards compliance, and efficiency

2015-06-05 Thread Jeff King
On Fri, Jun 05, 2015 at 01:41:21AM +, brian m. carlson wrote: > However, with the object_id conversion, we run into a problem: casting > those unsigned char * values into struct object_id * values is not > allowed by the C standard. There are two possible solutions: copying; > and the just-do

Pack files, standards compliance, and efficiency

2015-06-04 Thread brian m. carlson
There was discussion sometime back about the object_id conversions and handling direct offsets in pack files. In some places in sha1_file.c, we return direct pointers to the SHA-1 values in the mmap'd pack file and use those in other parts of the code. However, with the object_id conversion, we r