version 1.2, 2012/06/09 11:02:55 |
version 1.3, 2014/06/20 02:55:49 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <ohash.h> |
#include <ohash.h> |
|
|
void *xalloc(size_t sz, void *arg) { return(calloc(sz,1)); } |
void *xmalloc(size_t sz, void *arg) { return(calloc(1,sz)); } |
void xfree(void *p, size_t sz, void *arg) { free(p); } |
void *xcalloc(size_t nmemb, size_t sz, void *arg) { return(calloc(nmemb,sz)); } |
|
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.hfree = xfree; |
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; |