X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=commit-slab-impl.h;h=557738df271c7dd78c5ddcc65d6fe6e47c665758;hb=e96b271d185b59d93f7deab454a788c9d8dd0e50;hp=5c0eb91a5d175ddb079459a0ba13b9be1f74b1ab;hpb=b660a76d0f0f6b7bbf7e7d0b619edf0decc9d22e;p=thirdparty%2Fgit.git diff --git a/commit-slab-impl.h b/commit-slab-impl.h index 5c0eb91a5d..557738df27 100644 --- a/commit-slab-impl.h +++ b/commit-slab-impl.h @@ -38,6 +38,19 @@ scope void clear_ ##slabname(struct slabname *s) \ FREE_AND_NULL(s->slab); \ } \ \ +scope void deep_clear_ ##slabname(struct slabname *s, void (*free_fn)(elemtype *)) \ +{ \ + unsigned int i; \ + for (i = 0; i < s->slab_count; i++) { \ + unsigned int j; \ + if (!s->slab[i]) \ + continue; \ + for (j = 0; j < s->slab_size; j++) \ + free_fn(&s->slab[i][j * s->stride]); \ + } \ + clear_ ##slabname(s); \ +} \ + \ scope elemtype *slabname## _at_peek(struct slabname *s, \ const struct commit *c, \ int add_if_missing) \