klib
[Ported from github.com/attractivechaos/klib] added block arena
Brought by drakestapleton
| 1 | #include <stdio.h> |
| 2 | #include "klist.h" |
| 3 | |
| 4 | #define __int_free(x) |
| 5 | KLIST_INIT(32, int, __int_free) |
| 6 | |
| 7 | int main() |
| 8 | { |
| 9 | klist_t(32) *kl; |
| 10 | kliter_t(32) *p; |
| 11 | kl = kl_init(32); |
| 12 | *kl_pushp(32, kl) = 1; |
| 13 | *kl_pushp(32, kl) = 10; |
| 14 | kl_shift(32, kl, 0); |
| 15 | for (p = kl_begin(kl); p != kl_end(kl); p = kl_next(p)) |
| 16 | printf("%d\n", kl_val(p)); |
| 17 | kl_destroy(32, kl); |
| 18 | return 0; |
| 19 | } |