[BACK]Return to test-ohash.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / test-ohash.c (download)

Revision 1.5, Mon Jul 18 18:35:05 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, VERSION_1_14_5, VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2, VERSION_1_14_1, VERSION_1_13, HEAD
Changes since 1.4: +21 -3 lines

cope with -Wmissing-prototypes

#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <ohash.h>

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.alloc = xmalloc;
	i.calloc = xcalloc;
	i.free = xfree;
	ohash_init(&h, 2, &i);
	ohash_delete(&h);
	return 0;
}