=================================================================== RCS file: /cvs/mandoc/test-ohash.c,v retrieving revision 1.1 retrieving revision 1.5 diff -u -p -r1.1 -r1.5 --- mandoc/test-ohash.c 2012/06/09 11:00:13 1.1 +++ mandoc/test-ohash.c 2016/07/18 18:35:05 1.5 @@ -3,16 +3,36 @@ #include #include -void *xalloc(size_t sz, void *arg) { return(calloc(sz,1)); } -void xfree(void *p, size_t sz, void *arg) { free(p); } +static void *xmalloc(size_t, void *); +static void *xcalloc(size_t, size_t, void *); +static void xfree(void *, void *); + +static void * +xmalloc(size_t sz, void *arg) { + return calloc(1,sz); +} + +static void * +xcalloc(size_t nmemb, size_t sz, void *arg) +{ + return calloc(nmemb,sz); +} + +static void +xfree(void *p, void *arg) +{ + free(p); +} + int main(void) { struct ohash h; struct ohash_info i; - i.halloc = i.alloc = xalloc; - i.free = free; + i.alloc = xmalloc; + i.calloc = xcalloc; + i.free = xfree; ohash_init(&h, 2, &i); ohash_delete(&h); return 0;