[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.1, Sat Jun 9 11:00:13 2012 UTC (11 years, 10 months ago) by kristaps
Branch: MAIN

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.

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

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