aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-21 23:51:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-21 23:51:11 +0000
commit56bf7e8b9228994f0a7e6486d7dc6ce9ff9fb51d (patch)
tree9dd41221182398bcca78ba639f0743bf6520d448 /roff.c
parent8a6d6ac9ce00755e9537a67b9a9dd8f4c4e76d09 (diff)
downloadmandoc-56bf7e8b9228994f0a7e6486d7dc6ce9ff9fb51d.tar.gz
mandoc-56bf7e8b9228994f0a7e6486d7dc6ce9ff9fb51d.tar.zst
mandoc-56bf7e8b9228994f0a7e6486d7dc6ce9ff9fb51d.zip
Move all mdoc(7) node validation done before child parsing
to the new separate validation pass, except for a tiny bit needed by the parser which goes to the new mdoc_state() module; cleaner, simpler, and surprisingly also shorter by 15 lines.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/roff.c b/roff.c
index 12853cad..59207bdf 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.281 2015/10/20 02:01:32 schwarze Exp $ */
+/* $Id: roff.c,v 1.282 2015/10/21 23:51:11 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1025,47 +1025,31 @@ roff_node_append(struct roff_man *man, struct roff_node *n)
abort();
}
n->parent->nchild++;
-
- /*
- * Copy over the normalised-data pointer of our parent. Not
- * everybody has one, but copying a null pointer is fine.
- */
-
- switch (n->type) {
- case ROFFT_BODY:
- if (n->end != ENDBODY_NOT)
- break;
- /* FALLTHROUGH */
- case ROFFT_TAIL:
- case ROFFT_HEAD:
- n->norm = n->parent->norm;
- break;
- default:
- break;
- }
-
- if (man->macroset == MACROSET_MDOC)
- mdoc_valid_pre(man, n);
+ man->last = n;
switch (n->type) {
case ROFFT_HEAD:
- assert(n->parent->type == ROFFT_BLOCK);
n->parent->head = n;
break;
case ROFFT_BODY:
- if (n->end)
- break;
- assert(n->parent->type == ROFFT_BLOCK);
+ if (n->end != ENDBODY_NOT)
+ return;
n->parent->body = n;
break;
case ROFFT_TAIL:
- assert(n->parent->type == ROFFT_BLOCK);
n->parent->tail = n;
break;
default:
- break;
+ return;
}
- man->last = n;
+
+ /*
+ * Copy over the normalised-data pointer of our parent. Not
+ * everybody has one, but copying a null pointer is fine.
+ */
+
+ n->norm = n->parent->norm;
+ assert(n->parent->type == ROFFT_BLOCK);
}
void