X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/8b3150eb7ea715f96295991892f92da415734e01..130d794d1e169870967f8cbb047c5a35891cbfb7:/mdoc_macro.c diff --git a/mdoc_macro.c b/mdoc_macro.c index 790437cc..925f4a19 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.98 2010/12/06 11:01:19 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.101 2011/01/25 15:17:18 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -252,16 +252,26 @@ lookup_raw(const char *p) static int rew_last(struct mdoc *mdoc, const struct mdoc_node *to) { + struct mdoc_node *n, *np; assert(to); mdoc->next = MDOC_NEXT_SIBLING; /* LINTED */ while (mdoc->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. + */ + np = mdoc->last->parent; if ( ! mdoc_valid_post(mdoc)) return(0); - mdoc->last = mdoc->last->parent; + n = mdoc->last; + mdoc->last = np; assert(mdoc->last); + mdoc->last->last = n; } return(mdoc_valid_post(mdoc)); @@ -1451,6 +1461,8 @@ in_line_argn(MACRO_PROT_ARGS) case (MDOC_Ux): maxargs = 0; break; + case (MDOC_Bx): + /* FALLTHROUGH */ case (MDOC_Xr): maxargs = 2; break;