version 1.1, 2012/06/09 11:00:13 |
version 1.5, 2016/07/18 18:35:05 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <ohash.h> |
#include <ohash.h> |
|
|
void *xalloc(size_t sz, void *arg) { return(calloc(sz,1)); } |
static void *xmalloc(size_t, void *); |
void xfree(void *p, size_t sz, void *arg) { free(p); } |
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 |
int |
main(void) |
main(void) |
{ |
{ |
struct ohash h; |
struct ohash h; |
struct ohash_info i; |
struct ohash_info i; |
i.halloc = i.alloc = xalloc; |
i.alloc = xmalloc; |
i.free = free; |
i.calloc = xcalloc; |
|
i.free = xfree; |
ohash_init(&h, 2, &i); |
ohash_init(&h, 2, &i); |
ohash_delete(&h); |
ohash_delete(&h); |
return 0; |
return 0; |