diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-04-28 14:50:38 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-04-28 14:50:38 -0700 |
commit | 3ef4582ce52d89a7ac576b0f0c517773112a171c (patch) | |
tree | 37454fd6af68898e4dc78c6998b75fa526672464 /sys/libbio/phylo.c | |
parent | 9fd30c9e0ec9c5716b8cb7b8896318178d4b08bd (diff) |
fix: moved nnodes into a property of node
Diffstat (limited to 'sys/libbio/phylo.c')
-rw-r--r-- | sys/libbio/phylo.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |