summaryrefslogtreecommitdiffstats
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
commit4534f390e036ac23ee5e8f0373ffb9f4d785a17d (patch)
treeccd3380730c698bd52e2e5ea394772f7ac6e1e41 /read.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 'read.c')
-rw-r--r--read.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/read.c b/read.c
index c0b566f5..16687bce 100644
--- a/read.c
+++ b/read.c
@@ -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);
}