aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_macro.c
diff options
context:
space:
mode:
Diffstat (limited to 'man_macro.c')
-rw-r--r--man_macro.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/man_macro.c b/man_macro.c
index bd0ca992..dbc4b4b0 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.54 2010/12/08 10:58:22 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.55 2011/01/12 16:55:22 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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);
}