summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-05-01 16:02:47 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-05-01 16:02:47 +0000
commit14900fe7cc68ef746633548fdd98ddfc1085d664 (patch)
treec83903e66004c84c16a80498c3a1ae558370d5c0
parent69c57487163693701fa1106b63c28ab9fb674ede (diff)
downloadmandoc-14900fe7cc68ef746633548fdd98ddfc1085d664.tar.gz
Setting the "last" member of struct roff_node was done at an extremely
weird place. Move it to the obviously correct place. Surprisingly, this didn't cause any misformatting in the test suite or in any base system manuals, but i cannot believe the code was really correct for all conceivable input, and it would be very hard to verify. At the very least, it cannot have worked for man(7).
-rw-r--r--mdoc_macro.c4
-rw-r--r--roff.c1
2 files changed, 2 insertions, 3 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 5d8d3bfa..e8882db4 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -258,7 +258,7 @@ lookup(struct roff_man *mdoc, int from, int line, int ppos, const char *p)
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;
@@ -273,10 +273,8 @@ rew_last(struct roff_man *mdoc, const struct roff_node *to)
*/
np = mdoc->last->parent;
mdoc_valid_post(mdoc);
- n = mdoc->last;
mdoc->last = np;
assert(mdoc->last);
- mdoc->last->last = n;
}
mdoc_valid_post(mdoc);
}
diff --git a/roff.c b/roff.c
index ca0f85a4..4ab928c5 100644
--- a/roff.c
+++ b/roff.c
@@ -1022,6 +1022,7 @@ roff_node_append(struct roff_man *man, struct roff_node *n)
/* NOTREACHED */
}
n->parent->nchild++;
+ n->parent->last = n;
/*
* Copy over the normalised-data pointer of our parent. Not