summaryrefslogtreecommitdiff
path: root/src/libstddjb/genalloc_deepfree.c
blob: cda800a5edef447aeefb76d68213560f4673e6e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>

void genalloc_deepfree_size (genalloc *g, freefunc_t_ref f, unsigned int size)
{
  unsigned int len = g->len / size ;
  register unsigned int i = 0 ;
  for (; i < len ; i++) (*f)(g->s + i * size) ;
  stralloc_free(g) ;
}