summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc.h1
-rw-r--r--read.c1
-rw-r--r--roff.c33
3 files changed, 17 insertions, 18 deletions
diff --git a/mandoc.h b/mandoc.h
index 4ab6fb5a..16179014 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -165,7 +165,6 @@ enum mandocerr {
MANDOCERR_BADDISP, /* NOT IMPLEMENTED: .Bd -file */
MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
MANDOCERR_SO_FAIL, /* .so request failed */
- MANDOCERR_MEM, /* static buffer exhausted */
/* ===== system errors ===== */
diff --git a/read.c b/read.c
index 83ee1845..ccb647fe 100644
--- a/read.c
+++ b/read.c
@@ -209,7 +209,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"NOT IMPLEMENTED: .Bd -file",
"NOT IMPLEMENTED: .so with absolute path or \"..\"",
".so request failed",
- "static buffer exhausted",
/* system errors */
NULL,
diff --git a/roff.c b/roff.c
index fe26c1fe..bf7b9e88 100644
--- a/roff.c
+++ b/roff.c
@@ -106,11 +106,8 @@ struct roffreg {
struct roff {
struct mparse *parse; /* parse point */
- int options; /* parse options */
struct roffnode *last; /* leaf of stack */
- int rstack[RSTACK_MAX]; /* stack of !`ie' rules */
- char control; /* control character */
- int rstackpos; /* position in rstack */
+ int *rstack; /* stack of inverted `ie' values */
struct roffreg *regtab; /* number registers */
struct roffkv *strtab; /* user-defined strings & macros */
struct roffkv *xmbtab; /* multi-byte trans table (`tr') */
@@ -122,6 +119,10 @@ struct roff {
struct eqn_node *last_eqn; /* last equation parsed */
struct eqn_node *first_eqn; /* first equation parsed */
struct eqn_node *eqn; /* current equation being parsed */
+ int options; /* parse options */
+ int rstacksz; /* current size limit of rstack */
+ int rstackpos; /* position in rstack */
+ char control; /* control character */
};
struct roffnode {
@@ -420,32 +421,32 @@ roff_free1(struct roff *r)
r->first_tbl = tbl->next;
tbl_free(tbl);
}
-
r->first_tbl = r->last_tbl = r->tbl = NULL;
while (NULL != (e = r->first_eqn)) {
r->first_eqn = e->next;
eqn_free(e);
}
-
r->first_eqn = r->last_eqn = r->eqn = NULL;
while (r->last)
roffnode_pop(r);
- roff_freestr(r->strtab);
- roff_freestr(r->xmbtab);
-
- r->strtab = r->xmbtab = NULL;
+ free (r->rstack);
+ r->rstack = NULL;
+ r->rstacksz = 0;
+ r->rstackpos = -1;
roff_freereg(r->regtab);
-
r->regtab = NULL;
+ roff_freestr(r->strtab);
+ roff_freestr(r->xmbtab);
+ r->strtab = r->xmbtab = NULL;
+
if (r->xtab)
for (i = 0; i < 128; i++)
free(r->xtab[i].p);
-
free(r->xtab);
r->xtab = NULL;
}
@@ -1283,10 +1284,10 @@ roff_cond(ROFF_ARGS)
*/
if (ROFF_ie == tok) {
- if (r->rstackpos == RSTACK_MAX - 1) {
- mandoc_msg(MANDOCERR_MEM,
- r->parse, ln, ppos, NULL);
- return(ROFF_ERR);
+ if (r->rstackpos + 1 == r->rstacksz) {
+ r->rstacksz += 16;
+ r->rstack = mandoc_reallocarray(r->rstack,
+ r->rstacksz, sizeof(int));
}
r->rstack[++r->rstackpos] = !r->last->rule;
}