From 4534f390e036ac23ee5e8f0373ffb9f4d785a17d Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 18 Apr 2015 17:01:58 +0000 Subject: 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. --- mdoc_hash.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mdoc_hash.c') diff --git a/mdoc_hash.c b/mdoc_hash.c index 2615c764..7f7a47b1 100644 --- a/mdoc_hash.c +++ b/mdoc_hash.c @@ -32,16 +32,15 @@ static unsigned char table[27 * 12]; -/* - * XXX - this hash has global scope, so if intended for use as a library - * with multiple callers, it will need re-invocation protection. - */ void mdoc_hash_init(void) { int i, j, major; const char *p; + if (*table != '\0') + return; + memset(table, UCHAR_MAX, sizeof(table)); for (i = 0; i < (int)MDOC_MAX; i++) { -- cgit