get node children and refs in the same function
[protos/libecoli.git] / lib / ecoli_node_cmd.c
index 5b0d459..4ab13bd 100644 (file)
@@ -528,15 +528,18 @@ ec_node_cmd_get_children_count(const struct ec_node *gen_node)
        return 1;
 }
 
-static struct ec_node *
-ec_node_cmd_get_child(const struct ec_node *gen_node, size_t i)
+static int
+ec_node_cmd_get_child(const struct ec_node *gen_node, size_t i,
+               struct ec_node **child, unsigned int *refs)
 {
        struct ec_node_cmd *node = (struct ec_node_cmd *)gen_node;
 
        if (i > 0)
-               return NULL;
+               return -1;
 
-       return node->cmd;
+       *child = node->cmd;
+       *refs = 1;
+       return 0;
 }
 
 static struct ec_node_type ec_node_cmd_type = {