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
@@@ -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