builtin/describe.c: describe a blob
[gitweb.git] / commit-slab.h
index 42d16dcded870bfa400421a88b6d0d8c9309a404..dcaab8ca0437b3adefb523cad531ac1f4b9264e0 100644 (file)
@@ -78,25 +78,24 @@ static MAYBE_UNUSED void init_ ##slabname(struct slabname *s)               \
                                                                        \
 static MAYBE_UNUSED void clear_ ##slabname(struct slabname *s)         \
 {                                                                      \
-       int i;                                                          \
+       unsigned int i;                                                 \
        for (i = 0; i < s->slab_count; i++)                             \
                free(s->slab[i]);                                       \
        s->slab_count = 0;                                              \
-       free(s->slab);                                                  \
-       s->slab = NULL;                                                 \
+       FREE_AND_NULL(s->slab);                                         \
 }                                                                      \
                                                                        \
 static MAYBE_UNUSED elemtype *slabname## _at_peek(struct slabname *s,  \
                                                  const struct commit *c, \
                                                  int add_if_missing)   \
 {                                                                      \
-       int nth_slab, nth_slot;                                         \
+       unsigned int nth_slab, nth_slot;                                \
                                                                        \
        nth_slab = c->index / s->slab_size;                             \
        nth_slot = c->index % s->slab_size;                             \
                                                                        \
        if (s->slab_count <= nth_slab) {                                \
-               int i;                                                  \
+               unsigned int i;                                         \
                if (!add_if_missing)                                    \
                        return NULL;                                    \
                REALLOC_ARRAY(s->slab, nth_slab + 1);                   \