From: Junio C Hamano Date: Mon, 3 Aug 2015 18:01:21 +0000 (-0700) Subject: Merge branch 'jc/commit-slab' X-Git-Tag: v2.6.0-rc0~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=720e20eb68a476d43e59b9bd568da6cc4932a5ef;p=thirdparty%2Fgit.git Merge branch 'jc/commit-slab' Memory use reduction when commit-slab facility is used to annotate sparsely (which is not recommended in the first place). * jc/commit-slab: commit-slab: introduce slabname##_peek() function --- 720e20eb68a476d43e59b9bd568da6cc4932a5ef diff --cc commit-slab.h index f37ec3831f,9d12ce299c..f84b449413 --- a/commit-slab.h +++ b/commit-slab.h @@@ -90,7 -97,10 +97,9 @@@ static MAYBE_UNUSED elemtype *slabname# \ if (s->slab_count <= nth_slab) { \ int i; \ + if (!add_if_missing) \ + return NULL; \ - s->slab = xrealloc(s->slab, \ - (nth_slab + 1) * sizeof(*s->slab)); \ + REALLOC_ARRAY(s->slab, nth_slab + 1); \ stat_ ##slabname## realloc++; \ for (i = s->slab_count; i <= nth_slab; i++) \ s->slab[i] = NULL; \