summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-12-04 02:53:46 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-12-04 02:53:46 +0000
commit0ce81fa984870a181f12460f7f6a6a5637fc5d87 (patch)
treec02cbc475be98e57c56a721ce4917e0f81a414f4 /usr.bin/mandoc/roff.c
parentbc9ad67d8a3f34b3f956c2f5f238080e71c721bf (diff)
Clean up the validation of .Pp, .PP, .sp, and .br. Make sure all
combinations are handled, and are handled in a systematic manner. This resolves some erratic duplicate handling, handles a number of missing cases, and improves diagnostics in various respects. Move validation of .br and .sp to the roff validation module rather than doing that twice in the mdoc and man validation modules. Move the node relinking function to the roff library where it belongs. In validation functions, only look at the node itself, at previous nodes, and at descendants, not at following nodes or ancestors, such that only nodes are inspected which are already validated.
Diffstat (limited to 'usr.bin/mandoc/roff.c')
-rw-r--r--usr.bin/mandoc/roff.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index caed1da5cc5..796c01fb4e1 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.215 2018/11/26 17:44:29 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.216 2018/12/04 02:53:45 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -1065,6 +1065,14 @@ roff_node_unlink(struct roff_man *man, struct roff_node *n)
}
void
+roff_node_relink(struct roff_man *man, struct roff_node *n)
+{
+ roff_node_unlink(man, n);
+ n->prev = n->next = NULL;
+ roff_node_append(man, n);
+}
+
+void
roff_node_free(struct roff_node *n)
{