From c81baf94fd62c83c95a70727ad90da88092ccad7 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 9 Jun 2012 11:00:13 +0000 Subject: Add a compatibility interface for ohash. This include's espie@'s wholesale src/lib/libc/ohash directory from OpenBSD into compat_ohash.c (with a single copyright/license notice at the top) and src/include/ohash.h as compat_ohash.h. The ohash_int.h part of compat_ohash.c has been changed only in that ohash.h points to compat_ohash.h. Added HAVE_OHASH test (test-ohash.c) to Makefile. In mandocdb.c and mansearch.c, check HAVE_OHASH test for inclusion. --- test-ohash.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test-ohash.c (limited to 'test-ohash.c') diff --git a/test-ohash.c b/test-ohash.c new file mode 100644 index 00000000..72b3e3dd --- /dev/null +++ b/test-ohash.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +void *xalloc(size_t sz, void *arg) { return(calloc(sz,1)); } +void xfree(void *p, size_t sz, void *arg) { free(p); } + +int +main(void) +{ + struct ohash h; + struct ohash_info i; + i.halloc = i.alloc = xalloc; + i.free = free; + ohash_init(&h, 2, &i); + ohash_delete(&h); + return 0; +} -- cgit