From: Bert Wesarg Date: Wed, 13 Jul 2011 08:18:28 GMT Subject: Re: [RFC/PATCHv2 2/6] add metadata-cache infrastructure Message-ID: In-Reply-To: <20110713070405.GB18566@sigill.intra.peff.net> On Wed, Jul 13, 2011 at 09:04, Jeff King wrote: > diff --git a/metadata-cache.c b/metadata-cache.c > new file mode 100644 > index 0000000..e2e5ff8 > --- /dev/null > +++ b/metadata-cache.c > @@ -0,0 +1,337 @@ > +#include "cache.h" > +#include "metadata-cache.h" > +#include "sha1-lookup.h" > +#include "object.h" > + > +static struct metadata_cache **autowrite; > +static int autowrite_nr; > +static int autowrite_alloc; > + > +static int installed_atexit_autowriter; > + > +static int record_size(const struct metadata_cache *c) > +{ > +       /* a record is a 20-byte sha1 plus the width of the value */ > +       return c->mem.width + 20; You are circumventing your own API. Why do you don't use the decoration_width() accessor here? I don't see any check that METADATA_CACHE_INIT("frotz", 0, NULL) is invalid neither in the documentation nor in the code. > +} > + Bert