summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-12-14 06:33:14 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-12-14 06:33:14 +0000
commite7602bc16044a04fe97beac48909840f1b12ba4e (patch)
treeb489159f1ce065b9075402209449aab86376cc72 /roff.c
parente3863b1460cd9598ecb57705c9b22c2f2c552953 (diff)
downloadmandoc-e7602bc16044a04fe97beac48909840f1b12ba4e.tar.gz
Cleanup, no functional change:
Now that message handling is properly encapsulated, remove struct mparse pointers from four structs (roff, roff_man, tbl_node, eqn_node) and from the argument lists of five functions (roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc). Except for being passed to the main program as an opaque object, it now only occurs in read.c, as it should, and not across 15 files like in the past.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/roff.c b/roff.c
index c8bbde1a..99d33c84 100644
--- a/roff.c
+++ b/roff.c
@@ -98,7 +98,6 @@ struct mctx {
};
struct roff {
- struct mparse *parse; /* parse point */
struct roff_man *man; /* mdoc or man parser */
struct roffnode *last; /* leaf of stack */
struct mctx *mstack; /* stack of macro contexts */
@@ -780,12 +779,11 @@ roff_free(struct roff *r)
}
struct roff *
-roff_alloc(struct mparse *parse, int options)
+roff_alloc(int options)
{
struct roff *r;
r = mandoc_calloc(1, sizeof(struct roff));
- r->parse = parse;
r->reqtab = roffhash_alloc(0, ROFF_RENAMED);
r->options = options;
r->format = options & (MPARSE_MDOC | MPARSE_MAN);
@@ -844,13 +842,11 @@ roff_man_free(struct roff_man *man)
}
struct roff_man *
-roff_man_alloc(struct roff *roff, struct mparse *parse,
- const char *os_s, int quick)
+roff_man_alloc(struct roff *roff, const char *os_s, int quick)
{
struct roff_man *man;
man = mandoc_calloc(1, sizeof(*man));
- man->parse = parse;
man->roff = roff;
man->os_s = os_s;
man->quick = quick;
@@ -3148,7 +3144,7 @@ roff_EQ(ROFF_ARGS)
assert(r->eqn == NULL);
if (r->last_eqn == NULL)
- r->last_eqn = eqn_alloc(r->parse);
+ r->last_eqn = eqn_alloc();
else
eqn_reset(r->last_eqn);
r->eqn = r->last_eqn;
@@ -3182,7 +3178,7 @@ roff_TS(ROFF_ARGS)
mandoc_msg(MANDOCERR_BLK_BROKEN, ln, ppos, "TS breaks TS");
tbl_end(r->tbl, 0);
}
- r->tbl = tbl_alloc(ppos, ln, r->parse, r->last_tbl);
+ r->tbl = tbl_alloc(ppos, ln, r->last_tbl);
if (r->last_tbl == NULL)
r->first_tbl = r->tbl;
r->last_tbl = r->tbl;
@@ -3659,7 +3655,7 @@ roff_userdef(ROFF_ARGS)
ctx->argv = mandoc_reallocarray(ctx->argv,
ctx->argsz, sizeof(*ctx->argv));
}
- arg = mandoc_getarg(r->parse, &src, ln, &pos);
+ arg = mandoc_getarg(&src, ln, &pos);
sz = 1; /* For the terminating NUL. */
for (ap = arg; *ap != '\0'; ap++)
sz += *ap == '"' ? 4 : 1;