2014-11-22 18:08:25 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ohash.h>
|
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
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);
|
|
|
|
}
|
2014-11-22 18:08:25 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
struct ohash h;
|
|
|
|
struct ohash_info i;
|
|
|
|
i.alloc = xmalloc;
|
|
|
|
i.calloc = xcalloc;
|
|
|
|
i.free = xfree;
|
|
|
|
ohash_init(&h, 2, &i);
|
|
|
|
ohash_delete(&h);
|
|
|
|
return 0;
|
|
|
|
}
|