Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/mdocml/dist Really apply roff.c 1.134 for the c...
details: https://anonhg.NetBSD.org/src/rev/8689c0afa8cb
branches: trunk
changeset: 764317:8689c0afa8cb
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Apr 15 22:05:51 2011 +0000
description:
Really apply roff.c 1.134 for the conditional stack fix
diffstat:
external/bsd/mdocml/dist/roff.c | 57 +++++++++++++++++-----------------------
1 files changed, 24 insertions(+), 33 deletions(-)
diffs (85 lines):
diff -r 8208dd856748 -r 8689c0afa8cb external/bsd/mdocml/dist/roff.c
--- a/external/bsd/mdocml/dist/roff.c Fri Apr 15 21:47:39 2011 +0000
+++ b/external/bsd/mdocml/dist/roff.c Fri Apr 15 22:05:51 2011 +0000
@@ -277,10 +277,6 @@
assert(r->last);
p = r->last;
- if (ROFF_el == p->tok)
- if (r->rstackpos > -1)
- r->rstackpos--;
-
r->last = r->last->parent;
free(p->name);
free(p->end);
@@ -976,29 +972,20 @@
int sv;
enum roffrule rule;
- /* Stack overflow! */
-
- if (ROFF_ie == tok && r->rstackpos == RSTACK_MAX - 1) {
- mandoc_msg(MANDOCERR_MEM, r->parse, ln, ppos, NULL);
- return(ROFF_ERR);
- }
-
- /* First, evaluate the conditional. */
+ /*
+ * An `.el' has no conditional body: it will consume the value
+ * of the current rstack entry set in prior `ie' calls or
+ * defaults to DENY.
+ *
+ * If we're not an `el', however, then evaluate the conditional.
+ */
- if (ROFF_el == tok) {
- /*
- * An `.el' will get the value of the current rstack
- * entry set in prior `ie' calls or defaults to DENY.
- */
- if (r->rstackpos < 0)
- rule = ROFFRULE_DENY;
- else
- rule = r->rstack[r->rstackpos];
- } else
- rule = roff_evalcond(*bufp, &pos);
+ rule = ROFF_el == tok ?
+ (r->rstackpos < 0 ?
+ ROFFRULE_DENY : r->rstack[r->rstackpos--]) :
+ roff_evalcond(*bufp, &pos);
sv = pos;
-
while (' ' == (*bufp)[pos])
pos++;
@@ -1018,16 +1005,20 @@
r->last->rule = rule;
+ /*
+ * An if-else will put the NEGATION of the current evaluated
+ * conditional into the stack of rules.
+ */
+
if (ROFF_ie == tok) {
- /*
- * An if-else will put the NEGATION of the current
- * evaluated conditional into the stack.
- */
- r->rstackpos++;
- if (ROFFRULE_DENY == r->last->rule)
- r->rstack[r->rstackpos] = ROFFRULE_ALLOW;
- else
- r->rstack[r->rstackpos] = ROFFRULE_DENY;
+ if (r->rstackpos == RSTACK_MAX - 1) {
+ mandoc_msg(MANDOCERR_MEM,
+ r->parse, ln, ppos, NULL);
+ return(ROFF_ERR);
+ }
+ r->rstack[++r->rstackpos] =
+ ROFFRULE_DENY == r->last->rule ?
+ ROFFRULE_ALLOW : ROFFRULE_DENY;
}
/* If the parent has false as its rule, then so do we. */
Home |
Main Index |
Thread Index |
Old Index