git.droids-corp.org
/
protos
/
libecoli.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix config dump
[protos/libecoli.git]
/
lib
/
ecoli_node_once.c
diff --git
a/lib/ecoli_node_once.c
b/lib/ecoli_node_once.c
index
738b43d
..
6309878
100644
(file)
--- a/
lib/ecoli_node_once.c
+++ b/
lib/ecoli_node_once.c
@@
-88,6
+88,13
@@
ec_node_once_complete(const struct ec_node *gen_node,
return 0;
}
return 0;
}
+static void ec_node_once_free_priv(struct ec_node *gen_node)
+{
+ struct ec_node_once *node = (struct ec_node_once *)gen_node;
+
+ ec_node_free(node->child);
+}
+
static size_t
ec_node_once_get_children_count(const struct ec_node *gen_node)
{
static size_t
ec_node_once_get_children_count(const struct ec_node *gen_node)
{
@@
-98,15
+105,18
@@
ec_node_once_get_children_count(const struct ec_node *gen_node)
return 0;
}
return 0;
}
-static struct ec_node *
-ec_node_once_get_child(const struct ec_node *gen_node, size_t i)
+static int
+ec_node_once_get_child(const struct ec_node *gen_node, size_t i,
+ struct ec_node **child, unsigned int *refs)
{
struct ec_node_once *node = (struct ec_node_once *)gen_node;
if (i >= 1)
{
struct ec_node_once *node = (struct ec_node_once *)gen_node;
if (i >= 1)
- return
NULL
;
+ return
-1
;
- return node->child;
+ *child = node->child;
+ *refs = 1;
+ return 0;
}
static struct ec_node_type ec_node_once_type = {
}
static struct ec_node_type ec_node_once_type = {
@@
-114,6
+124,7
@@
static struct ec_node_type ec_node_once_type = {
.parse = ec_node_once_parse,
.complete = ec_node_once_complete,
.size = sizeof(struct ec_node_once),
.parse = ec_node_once_parse,
.complete = ec_node_once_complete,
.size = sizeof(struct ec_node_once),
+ .free_priv = ec_node_once_free_priv,
.get_children_count = ec_node_once_get_children_count,
.get_child = ec_node_once_get_child,
};
.get_children_count = ec_node_once_get_children_count,
.get_child = ec_node_once_get_child,
};
@@
-148,7
+159,7
@@
struct ec_node *ec_node_once(const char *id, struct ec_node *child)
if (child == NULL)
return NULL;
if (child == NULL)
return NULL;
- gen_node =
__ec_nod
e(&ec_node_once_type, id);
+ gen_node =
ec_node_from_typ
e(&ec_node_once_type, id);
if (gen_node == NULL)
goto fail;
if (gen_node == NULL)
goto fail;