source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Setting the "last" member of struct roff_node was done at an
@ 2015-05-01 16:03 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-05-01 16:03 UTC (permalink / raw)
  To: source

Log Message:
-----------
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).

Modified Files:
--------------
    mdocml:
        mdoc_macro.c
        roff.c

Revision Data
-------------
Index: mdoc_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.198 -r1.199
--- mdoc_macro.c
+++ mdoc_macro.c
@@ -258,7 +258,7 @@ lookup(struct roff_man *mdoc, int from, 
 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 st
 		 */
 		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);
 }
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.269
retrieving revision 1.270
diff -Lroff.c -Lroff.c -u -p -r1.269 -r1.270
--- roff.c
+++ roff.c
@@ -1022,6 +1022,7 @@ roff_node_append(struct roff_man *man, s
 		/* NOTREACHED */
 	}
 	n->parent->nchild++;
+	n->parent->last = n;
 
 	/*
 	 * Copy over the normalised-data pointer of our parent.  Not
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-01 16:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-01 16:03 mdocml: Setting the "last" member of struct roff_node was done at an schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).