diff options
author | 2012-06-09 11:00:13 +0000 | |
---|---|---|
committer | 2012-06-09 11:00:13 +0000 | |
commit | edbd1fa554d38a3f19ff970c944800ddf36ac396 (patch) | |
tree | b222233773ffd22fd69619a83584ed4101b26b02 /mandocdb.c | |
parent | 23b47a76c2d0b34fa0a6e8bdea1f0c5db87aac33 (diff) | |
download | mandoc-edbd1fa554d38a3f19ff970c944800ddf36ac396.tar.gz mandoc-edbd1fa554d38a3f19ff970c944800ddf36ac396.tar.zst mandoc-edbd1fa554d38a3f19ff970c944800ddf36ac396.zip |
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.
Diffstat (limited to 'mandocdb.c')
-rw-r--r-- | mandocdb.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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 <kristaps@bsd.lv> * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> @@ -34,7 +34,11 @@ #include <string.h> #include <unistd.h> +#ifdef HAVE_OHASH #include <ohash.h> +#else +#include "compat_ohash.h" +#endif #include <sqlite3.h> #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); |