1#include <stdint.h> 2#include <stddef.h> 3#include <stdlib.h> 4#include <ohash.h> 5 6static void *xmalloc(size_t, void *); 7static void *xcalloc(size_t, size_t, void *); 8static void xfree(void *, void *); 9 10 11static void * 12xmalloc(size_t sz, void *arg) { 13 return calloc(1,sz); 14} 15 16static void * 17xcalloc(size_t nmemb, size_t sz, void *arg) 18{ 19 return calloc(nmemb,sz); 20} 21 22static void 23xfree(void *p, void *arg) 24{ 25 free(p); 26} 27 28int 29main(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} 40