Merge branch 'jc/commit-slab'
authorJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 18:01:21 +0000 (11:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 18:01:21 +0000 (11:01 -0700)
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

1  2 
commit-slab.h
commit.c
diff --cc commit-slab.h
index f37ec3831f60cb9072d6cbf4f3d0126bc0681bf1,9d12ce299cb844bd7bd74d0b5813af2932868773..f84b449413d434b8145426503a98bcd4f9ad995f
@@@ -90,7 -97,10 +97,9 @@@ static MAYBE_UNUSED elemtype *slabname#
                                                                        \
        if (s->slab_count <= nth_slab) {                                \
                int i;                                                  \
 -              s->slab = xrealloc(s->slab,                             \
 -                                 (nth_slab + 1) * sizeof(*s->slab));  \
+               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;                              \
diff --cc commit.c
Simple merge