From edbd1fa554d38a3f19ff970c944800ddf36ac396 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. --- mandocdb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mandocdb.c') diff --git a/mandocdb.c b/mandocdb.c index b3730139..78aefad4 100644 --- a/mandocdb.c +++ b/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.52 2012/06/08 15:06:28 kristaps Exp $ */ +/* $Id: mandocdb.c,v 1.53 2012/06/09 11:00:13 kristaps Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012 Ingo Schwarze @@ -34,7 +34,11 @@ #include #include +#ifdef HAVE_OHASH #include +#else +#include "compat_ohash.h" +#endif #include #include "mdoc.h" @@ -327,6 +331,7 @@ main(int argc, char *argv[]) { char cwd[MAXPATHLEN]; int ch, rc, fd, i; + unsigned int index; size_t j, sz; const char *dir; struct str *s; @@ -521,8 +526,8 @@ out: manpath_free(&dirs); mchars_free(mc); mparse_free(mp); - for (s = ohash_first(&strings, &ch); - NULL != s; s = ohash_next(&strings, &ch)) { + for (s = ohash_first(&strings, &index); + NULL != s; s = ohash_next(&strings, &index)) { if (s->utf8 != s->key) free(s->utf8); free(s); -- cgit v1.2.3