]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/mandoc/test-ohash.c
THIS BRANCH IS OBSOLETE, PLEASE READ:
[FreeBSD/FreeBSD.git] / contrib / mandoc / test-ohash.c
1 #include <stdint.h>
2 #include <stddef.h>
3 #include <stdlib.h>
4 #include <ohash.h>
5
6 static void     *xmalloc(size_t, void *);
7 static void     *xcalloc(size_t, size_t, void *);
8 static void      xfree(void *, void *);
9
10
11 static void *
12 xmalloc(size_t sz, void *arg) {
13         return calloc(1,sz);
14 }
15
16 static void *
17 xcalloc(size_t nmemb, size_t sz, void *arg)
18 {
19         return calloc(nmemb,sz);
20 }
21
22 static void
23 xfree(void *p, void *arg)
24 {
25         free(p);
26 }
27
28 int
29 main(void)
30 {
31         struct ohash h;
32         struct ohash_info i;
33         i.alloc = xmalloc;
34         i.calloc = xcalloc;
35         i.free = xfree;
36         ohash_init(&h, 2, &i);
37         ohash_delete(&h);
38         return 0;
39 }