summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-01-08 17:48:05 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-01-08 17:48:05 +0000
commitacd4f569237dcdcc8fa8acec7b1125a2f37815a4 (patch)
treeca5b1689319be7347e802acf8150955a8dad94b2 /usr.bin/mandoc/roff.c
parentcf6760ace1c337cbeb0f8b6842d8a4a084627f68 (diff)
Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a tiny loop - not only making data smaller, but code shorter as well. This gets rid of an implicit invariant that confused both static analysis tools and human auditors. No functional change.
Diffstat (limited to 'usr.bin/mandoc/roff.c')
-rw-r--r--usr.bin/mandoc/roff.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 674b17cfa7e..2474f9a0f3d 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.155 2015/10/22 21:53:49 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.156 2016/01/08 17:48:04 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1022,7 +1022,6 @@ roff_node_append(struct roff_man *man, struct roff_node *n)
default:
abort();
}
- n->parent->nchild++;
man->last = n;
switch (n->type) {
@@ -1167,7 +1166,6 @@ roff_node_unlink(struct roff_man *man, struct roff_node *n)
/* Adjust parent. */
if (n->parent != NULL) {
- n->parent->nchild--;
if (n->parent->child == n)
n->parent->child = n->next;
if (n->parent->last == n)
@@ -1209,7 +1207,6 @@ roff_node_delete(struct roff_man *man, struct roff_node *n)
while (n->child != NULL)
roff_node_delete(man, n->child);
- assert(n->nchild == 0);
roff_node_unlink(man, n);
roff_node_free(n);
}