From 517aac06093f32752f40e67b9987a09fb33ac2e4 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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/man_macro.c b/man_macro.c index c5a7d4ab..1d0a431b 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.63 2011/06/18 17:36:52 kristaps Exp $ */ +/* $Id: man_macro.c,v 1.64 2011/07/07 05:42:32 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -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 v1.2.3-56-ge451