From c90e17bfe549f6a33060192d25fc7faa7dd1fa9f Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 7 Jul 2011 05:42:32 +0000 Subject: Fix a bug in the -man parser where deleting nodes (such as `PP' or `LP' in certain situations) caused the next macros to be assigned as siblings instead of child nodes to the original parent. Noticed and ok by schwarze@. --- man_macro.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/man_macro.c b/man_macro.c index e320a6e2..10611669 100644 --- a/man_macro.c +++ b/man_macro.c @@ -120,6 +120,9 @@ man_unscope(struct man *m, const struct man_node *to, assert(to); + assert(MAN_ROOT != m->last->type); + m->next = MAN_NEXT_SIBLING; + /* LINTED */ while (m->last != to) { /* @@ -140,9 +143,6 @@ man_unscope(struct man *m, const struct man_node *to, if ( ! man_valid_post(m)) return(0); - m->next = MAN_ROOT == m->last->type ? - MAN_NEXT_CHILD : MAN_NEXT_SIBLING; - return(1); } @@ -428,6 +428,9 @@ in_line_eoln(MACRO_PROT_ARGS) assert( ! (MAN_SCOPED & man_macros[tok].flags)); m->flags |= MAN_ILINE; } + + assert(MAN_ROOT != m->last->type); + m->next = MAN_NEXT_SIBLING; /* * Rewind our element scope. Note that when TH is pruned, we'll @@ -453,9 +456,6 @@ in_line_eoln(MACRO_PROT_ARGS) if (m->last->type != MAN_ROOT && ! man_valid_post(m)) return(0); - m->next = MAN_ROOT == m->last->type ? - MAN_NEXT_CHILD : MAN_NEXT_SIBLING; - return(1); } -- cgit