Re: [RFC/PATCHv2 1/6] decorate: allow storing values instead of pointers
- From
Jeff King <peff@peff.net>
- Date
- Jul 14, 2011, 17:34 UTC
- Message-ID
- <20110714173454.GA21657@sigill.intra.peff.net>
- In-Reply-To
- <20110713200814.GD31965@sigill.intra.peff.net>
On Wed, Jul 13, 2011 at 04:08:14PM -0400, Jeff King wrote:
Show 5 quoted lines
> I have to say, though, between the alignment issues and the strict > aliasing, I am tempted to scrap this whole approach and just use macros > to define the few functions we need. It's not like these containers are > heterogenous, or that we have a ton of types. Right now we want to map > "void *" and "uint32_t". In the future, I'd like to map a 20-byte sha1.
So here's what that would look like (at least the decorate part).
Doing macro meta-programming like this makes me feel a little dirty, but I actually think the result is more readable.
[1/3]: implement generic key/value map [2/3]: fast-export: use object to uint32 map instead of "decorate" [3/3]: decorate: use "map" for the underlying implementation
What do you think?
-Peff