summaryrefslogtreecommitdiffstats
path: root/man_hash.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-18 17:01:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-18 17:01:58 +0000
commit4534f390e036ac23ee5e8f0373ffb9f4d785a17d (patch)
treeccd3380730c698bd52e2e5ea394772f7ac6e1e41 /man_hash.c
parent19dfb5cab356150bf46d159f43ead732a6a6ade5 (diff)
downloadmandoc-4534f390e036ac23ee5e8f0373ffb9f4d785a17d.tar.gz
Move mdoc_hash_init() and man_hash_init() to libmandoc.h
and call them from mparse_alloc() and choose_parser(), preparing unified allocation of struct roff_man.
Diffstat (limited to 'man_hash.c')
-rw-r--r--man_hash.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/man_hash.c b/man_hash.c
index 52d67a2b..a0aed934 100644
--- a/man_hash.c
+++ b/man_hash.c
@@ -47,15 +47,14 @@
static unsigned char table[26 * HASH_DEPTH];
-/*
- * XXX - this hash has global scope, so if intended for use as a library
- * with multiple callers, it will need re-invocation protection.
- */
void
man_hash_init(void)
{
int i, j, x;
+ if (*table != '\0')
+ return;
+
memset(table, UCHAR_MAX, sizeof(table));
assert(MAN_MAX < UCHAR_MAX);