diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-12 16:55:22 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-12 16:55:22 +0000 |
commit | 4f91378ad02e8f45eb622157ec28b4b7b95ccb63 (patch) | |
tree | 3c2e9de28f5d8f2144a5fa95c374f3de1f2c53e0 /man_macro.c | |
parent | 2dcec7ae5910c79dff9f5cea75f2569848bc2d0a (diff) | |
download | mandoc-4f91378ad02e8f45eb622157ec28b4b7b95ccb63.tar.gz |
Downgrade -man message of ignored empty paragraph to MANDOC_IGNPAR. The
change in man_macro.c was from an assertion caused by a subtle problem:
(1) macro is removed, causing m->last to be m->last->parent; (2) by jumping
to the m->last->parent after post-validation, the original
m->last->parent is skipped; (3) the rewinder climbs to the root of the
tree and aborts.
The original issue recorded in the TODO by schwarze@, reminded by Brad
Smith.
Diffstat (limited to 'man_macro.c')
-rw-r--r-- | man_macro.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/man_macro.c b/man_macro.c index 5a5d2366..076ca078 100644 --- a/man_macro.c +++ b/man_macro.c @@ -107,19 +107,27 @@ rew_warn(struct man *m, struct man_node *n, enum mandocerr er) * will be used if an explicit block scope is being closed out. */ int -man_unscope(struct man *m, const struct man_node *n, +man_unscope(struct man *m, const struct man_node *to, enum mandocerr er) { + struct man_node *n; - assert(n); + assert(to); /* LINTED */ - while (m->last != n) { + while (m->last != to) { + /* + * Save the parent here, because we may delete the + * m->last node in the post-validation phase and reset + * it to m->last->parent, causing a step in the closing + * out to be lost. + */ + n = m->last->parent; if ( ! rew_warn(m, m->last, er)) return(0); if ( ! man_valid_post(m)) return(0); - m->last = m->last->parent; + m->last = n; assert(m->last); } |