aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit4c2762423e7dcaf40f505c9000f23b6f18a484e5 (patch)
tree506be8e4f33431f64d95bfecad57d08f20be9dba /roff.c
parent7a6eb8920bdea2ecc151b308352b2a98699b2350 (diff)
downloadmandoc-4c2762423e7dcaf40f505c9000f23b6f18a484e5.tar.gz
mandoc-4c2762423e7dcaf40f505c9000f23b6f18a484e5.tar.zst
mandoc-4c2762423e7dcaf40f505c9000f23b6f18a484e5.zip
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.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/roff.c b/roff.c
index 1f7d45b4..a303c86b 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.350 2018/12/14 05:18:03 schwarze Exp $ */
+/* $Id: roff.c,v 1.351 2018/12/14 06:33:14 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;