Re: [PATCH 27/35] commit-slabs: remove realloc counter outside of slab struct
- From
Derrick Stolee <stolee@gmail.com>
- Date
- May 30, 2018, 19:00 UTC
- Message-ID
- <45386849-9a42-a639-06de-78d7e127407b@gmail.com>
- In-Reply-To
- <20180530004810.30076-28-sbeller@google.com>
On 5/29/2018 8:48 PM, Stefan Beller wrote:
Show 7 quoted lines
> The realloc counter is declared outside the struct for the given slabname, > which makes it harder for a follow up patch to move the declaration of the > struct around as then the counter variable would need special treatment. > > As the reallocation counter is currently unused we can just remove it. > If we ever need to count the reallocations again, we can reintroduce > the counter as part of 'struct slabname' in commit-slab-decl.h.
It's worth noting that this patch is different from the other mechanical patches. I do agree that we should remove this unused portion of the slab API. Likely this was built for testing purposes.
CC'ing Junio, who I found introduced this in a84b794ad "commit-slab: introduce a macro to define a slab for new type". Looking at that diff, the realloc portion did not appear to exist in the previous in-degree-specific version of slabs.
Show 27 quoted lines
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> commit-slab-impl.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/commit-slab-impl.h b/commit-slab-impl.h
> index 87a9cadfcca..ac1e6d409ad 100644
> --- a/commit-slab-impl.h
> +++ b/commit-slab-impl.h
> @@ -11,8 +11,6 @@
>
> #define implement_commit_slab(slabname, elemtype, scope) \
> \
> -static int stat_ ##slabname## realloc; \
> - \
> scope void init_ ##slabname## _with_stride(struct slabname *s, \
> unsigned stride) \
> { \
> @@ -54,7 +52,6 @@ scope elemtype *slabname## _at_peek(struct slabname *s, \
> if (!add_if_missing) \
> return NULL; \
> REALLOC_ARRAY(s->slab, nth_slab + 1); \
> - stat_ ##slabname## realloc++; \
> for (i = s->slab_count; i <= nth_slab; i++) \
> s->slab[i] = NULL; \
> s->slab_count = nth_slab + 1; \