From 924c4755ac64b780903344b188653f513990a771 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 8 Jan 2016 17:48:09 +0000 Subject: 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. --- roff.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'roff.c') diff --git a/roff.c b/roff.c index 4ee44f15..13b9439e 100644 --- a/roff.c +++ b/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.283 2015/10/22 21:54:23 schwarze Exp $ */ +/* $Id: roff.c,v 1.284 2016/01/08 17:48:10 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -1024,7 +1024,6 @@ roff_node_append(struct roff_man *man, struct roff_node *n) default: abort(); } - n->parent->nchild++; man->last = n; switch (n->type) { @@ -1169,7 +1168,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) @@ -1211,7 +1209,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); } -- cgit v1.2.3-56-ge451