"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: towards sha256 pack files: opaquify sorted_ids
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 8 Mar 2023 14:44:42 +0100

Download raw body.

Thread
On Wed, Mar 01, 2023 at 07:40:24PM +0100, Omar Polo wrote:
> Hello,
> 
> This is a first step to make handle sha256 object ids in pack files.
> It is also the messiest and the one I'm less sure about.
> 
> The `sorted_ids' field is an "array" of 20-bytes SHA1 digests
> currently, but in sha256 repos it is made of 40-bytes SHA256 digests.
> 
> I'm trying to make it "opaque" and providing a macro for lower-level
> code to access it and retiring the struct got_packidx_object_id that
> is now completely unused.  I'm still not completely sold on the way
> I've handled it, but it's the best idea I could come up with.

Why is GOT_PACKIDX_GET_OBJECT a macro while the other helpers you've
added are inline functions?
I don't see a reason why GOT_PACKIDX_GET_OBJECT could not be an inline
function as well, or even just a regular function, which would return
a void * the caller can cast if needed, or even a struct got_object_id *.
This would add type checking of the arguments and also make things easier
to debug in gdb.

Since this macro/function returns an object ID wouldn't a better name be
GOT_PACKIDX_GET_OBJECT_ID/got_packidx_get_object_id?