diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-18 17:01:58 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-18 17:01:58 +0000 |
commit | 24719645e5444a6acaeb47260a958a471c5eeffe (patch) | |
tree | c81b110c1963e76c1b017df27cbee7ab8c2dad23 /mdoc_hash.c | |
parent | 70a9dbd1a5a305812354c332d729472bd2c06561 (diff) | |
download | mandoc-24719645e5444a6acaeb47260a958a471c5eeffe.tar.gz mandoc-24719645e5444a6acaeb47260a958a471c5eeffe.tar.zst mandoc-24719645e5444a6acaeb47260a958a471c5eeffe.zip |
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 'mdoc_hash.c')
-rw-r--r-- | mdoc_hash.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mdoc_hash.c b/mdoc_hash.c index cd576511..0da3c9a1 100644 --- a/mdoc_hash.c +++ b/mdoc_hash.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_hash.c,v 1.23 2015/04/02 22:48:17 schwarze Exp $ */ +/* $Id: mdoc_hash.c,v 1.24 2015/04/18 17:01:58 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -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++) { |