=================================================================== RCS file: /cvs/mandoc/mdoc_macro.c,v retrieving revision 1.196 retrieving revision 1.200 diff -u -p -r1.196 -r1.200 --- mandoc/mdoc_macro.c 2015/04/29 14:48:53 1.196 +++ mandoc/mdoc_macro.c 2015/05/01 16:58:33 1.200 @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.196 2015/04/29 14:48:53 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.200 2015/05/01 16:58:33 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -258,12 +258,11 @@ lookup(struct roff_man *mdoc, int from, int line, int static void rew_last(struct roff_man *mdoc, const struct roff_node *to) { - struct roff_node *n, *np; + struct roff_node *np; if (to->flags & MDOC_VALID) return; - mdoc->next = ROFF_NEXT_SIBLING; while (mdoc->last != to) { /* * Save the parent here, because we may delete the @@ -273,11 +272,10 @@ rew_last(struct roff_man *mdoc, const struct roff_node */ np = mdoc->last->parent; mdoc_valid_post(mdoc); - n = mdoc->last; mdoc->last = np; assert(mdoc->last); - mdoc->last->last = n; } + mdoc->next = ROFF_NEXT_SIBLING; mdoc_valid_post(mdoc); } @@ -673,6 +671,8 @@ blk_exp_close(MACRO_PROT_ARGS) if (endbody != NULL) n = endbody; + + ntok = TOKEN_NONE; for (j = 0; ; j++) { lastarg = *pos; @@ -700,7 +700,7 @@ blk_exp_close(MACRO_PROT_ARGS) } if (n != NULL) { - if (n != mdoc->last && n->flags & MDOC_BROKEN) { + if (ntok != TOKEN_NONE && n->flags & MDOC_BROKEN) { target = n; do target = target->parent; @@ -1397,7 +1397,7 @@ in_line_eoln(MACRO_PROT_ARGS) if (mdoc->next == ROFF_NEXT_SIBLING) n = n->parent; if (n->tok == MDOC_Nm) - rew_last(mdoc, mdoc->last->parent); + rew_last(mdoc, n->parent); } if (buf[*pos] == '\0' &&