From 3ef4582ce52d89a7ac576b0f0c517773112a171c Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 28 Apr 2020 14:50:38 -0700 Subject: fix: moved nnodes into a property of node --- sys/libbio/phylo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/libbio/phylo.c') diff --git a/sys/libbio/phylo.c b/sys/libbio/phylo.c index 71901ba..d03bc48 100644 --- a/sys/libbio/phylo.c +++ b/sys/libbio/phylo.c @@ -51,18 +51,20 @@ phylo·rmchild(bio·Node* parent, bio·Node* child) error phylo·countnodes(bio·Node *node, int *n) { + int m; error err; bio·Node *child; - node->nnode = 0; + m = *n; for (child = node->child; child != nil; child = child->sibling) { - if (err = phylo·countnodes(child, &node->nnode), err) { + if (err = phylo·countnodes(child, n), err) { errorf("node count: failure at '%s'", child->name); return 1; } } + node->nnode = *n - m; + *n += 1; - *n += node->nnode + 1; return 0; } -- cgit v1.2.1