Index: sys/sys/_bitset.h =================================================================== --- sys/sys/_bitset.h +++ sys/sys/_bitset.h @@ -58,4 +58,15 @@ #define BITSET_FSET(n) \ [ 0 ... ((n) - 1) ] = (-1L) +/* + * Helpers to allocate a bitset without it's size being a constant. + * + * Sadly we cannot allocate a bitset struct with '__bits[]', because it's + * the only member of the struct. + */ +#define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1) +#define BITSET_FREE(p, mt) free(p, mt) +#define BITSET_ALLOC(p, _s, mt, mf) \ + p = malloc(__bitset_words(_s) * sizeof(long), mt, mf) + #endif /* !_SYS__BITSET_H_ */