aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.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
commit24719645e5444a6acaeb47260a958a471c5eeffe (patch)
treec81b110c1963e76c1b017df27cbee7ab8c2dad23 /read.c
parent70a9dbd1a5a305812354c332d729472bd2c06561 (diff)
downloadmandoc-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 'read.c')
-rw-r--r--read.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/read.c b/read.c
index bde299c9..1417aeca 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.135 2015/04/18 16:34:25 schwarze Exp $ */
+/* $Id: read.c,v 1.136 2015/04/18 17:01:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -296,6 +296,7 @@ choose_parser(struct mparse *curp)
MPARSE_QUICK & curp->options ? 1 : 0);
else
curp->man->macroset = MACROSET_MDOC;
+ mdoc_hash_init();
return;
}
@@ -307,6 +308,7 @@ choose_parser(struct mparse *curp)
MPARSE_QUICK & curp->options ? 1 : 0);
else
curp->man->macroset = MACROSET_MAN;
+ man_hash_init();
}
/*
@@ -890,14 +892,18 @@ mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg,
curp->mchars = mchars;
curp->roff = roff_alloc(curp, curp->mchars, options);
- if (curp->options & MPARSE_MDOC)
+ if (curp->options & MPARSE_MDOC) {
curp->man = mdoc_alloc(
curp->roff, curp, curp->defos,
curp->options & MPARSE_QUICK ? 1 : 0);
- if (curp->options & MPARSE_MAN)
+ mdoc_hash_init();
+ }
+ if (curp->options & MPARSE_MAN) {
curp->man = man_alloc(
curp->roff, curp, curp->defos,
curp->options & MPARSE_QUICK ? 1 : 0);
+ man_hash_init();
+ }
return(curp);
}