1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-29 12:03:03 +00:00
freebsd/contrib/mdocml/test-ohash.c
Baptiste Daroussin 7666f5006c Import mandoc cvs snapshot 20170121 (pre 1.14)
Note that mandoc does not use anymore sqlite3 but a home made database format
An important improvement has been made as well in makewhatis performance:
Tests on my laptop shows makewhatis on the entire system goes from 26s to 12s
2017-01-21 13:17:25 +00:00

40 lines
585 B
C

#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;
}