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
api documentation for ec_parse
[protos/libecoli.git]
/
src
/
ecoli_node_any.c
diff --git
a/src/ecoli_node_any.c
b/src/ecoli_node_any.c
index
88ac542
..
5bf4984
100644
(file)
--- a/
src/ecoli_node_any.c
+++ b/
src/ecoli_node_any.c
@@
-21,35
+21,34
@@
EC_LOG_TYPE_REGISTER(node_any);
struct ec_node_any {
EC_LOG_TYPE_REGISTER(node_any);
struct ec_node_any {
- struct ec_node gen;
char *attr_name;
};
char *attr_name;
};
-static int ec_node_any_parse(const struct ec_node *
gen_
node,
- struct ec_p
arse *
state,
+static int ec_node_any_parse(const struct ec_node *node,
+ struct ec_p
node *p
state,
const struct ec_strvec *strvec)
{
const struct ec_strvec *strvec)
{
- struct ec_node_any *
node = (struct ec_node_any *)gen_node
;
+ struct ec_node_any *
priv = ec_node_priv(node)
;
const struct ec_dict *attrs;
const struct ec_dict *attrs;
- (void)state;
+ (void)
p
state;
if (ec_strvec_len(strvec) == 0)
return EC_PARSE_NOMATCH;
if (ec_strvec_len(strvec) == 0)
return EC_PARSE_NOMATCH;
- if (
node
->attr_name != NULL) {
+ if (
priv
->attr_name != NULL) {
attrs = ec_strvec_get_attrs(strvec, 0);
attrs = ec_strvec_get_attrs(strvec, 0);
- if (attrs == NULL || !ec_dict_has_key(attrs,
node
->attr_name))
+ if (attrs == NULL || !ec_dict_has_key(attrs,
priv
->attr_name))
return EC_PARSE_NOMATCH;
}
return 1;
}
return EC_PARSE_NOMATCH;
}
return 1;
}
-static void ec_node_any_free_priv(struct ec_node *
gen_
node)
+static void ec_node_any_free_priv(struct ec_node *node)
{
{
- struct ec_node_any *
node = (struct ec_node_any *)gen_node
;
+ struct ec_node_any *
priv = ec_node_priv(node)
;
- ec_free(
node
->attr_name);
+ ec_free(
priv
->attr_name);
}
static const struct ec_config_schema ec_node_any_schema[] = {
}
static const struct ec_config_schema ec_node_any_schema[] = {
@@
-63,10
+62,10
@@
static const struct ec_config_schema ec_node_any_schema[] = {
},
};
},
};
-static int ec_node_any_set_config(struct ec_node *
gen_
node,
+static int ec_node_any_set_config(struct ec_node *node,
const struct ec_config *config)
{
const struct ec_config *config)
{
- struct ec_node_any *
node = (struct ec_node_any *)gen_node
;
+ struct ec_node_any *
priv = ec_node_priv(node)
;
const struct ec_config *value = NULL;
char *s = NULL;
const struct ec_config *value = NULL;
char *s = NULL;
@@
-77,8
+76,8
@@
static int ec_node_any_set_config(struct ec_node *gen_node,
goto fail;
}
goto fail;
}
- ec_free(
node
->attr_name);
-
node
->attr_name = s;
+ ec_free(
priv
->attr_name);
+
priv
->attr_name = s;
return 0;
return 0;
@@
-92,7
+91,6
@@
static struct ec_node_type ec_node_any_type = {
.schema = ec_node_any_schema,
.set_config = ec_node_any_set_config,
.parse = ec_node_any_parse,
.schema = ec_node_any_schema,
.set_config = ec_node_any_set_config,
.parse = ec_node_any_parse,
- .complete = ec_node_complete_unknown,
.size = sizeof(struct ec_node_any),
.free_priv = ec_node_any_free_priv,
};
.size = sizeof(struct ec_node_any),
.free_priv = ec_node_any_free_priv,
};
@@
-103,11
+101,11
@@
struct ec_node *
ec_node_any(const char *id, const char *attr)
{
struct ec_config *config = NULL;
ec_node_any(const char *id, const char *attr)
{
struct ec_config *config = NULL;
- struct ec_node *
gen_
node = NULL;
+ struct ec_node *node = NULL;
int ret;
int ret;
-
gen_
node = ec_node_from_type(&ec_node_any_type, id);
- if (
gen_
node == NULL)
+ node = ec_node_from_type(&ec_node_any_type, id);
+ if (node == NULL)
return NULL;
config = ec_config_dict();
return NULL;
config = ec_config_dict();
@@
-118,16
+116,16
@@
ec_node_any(const char *id, const char *attr)
if (ret < 0)
goto fail;
if (ret < 0)
goto fail;
- ret = ec_node_set_config(
gen_
node, config);
+ ret = ec_node_set_config(node, config);
config = NULL;
if (ret < 0)
goto fail;
config = NULL;
if (ret < 0)
goto fail;
- return
gen_
node;
+ return node;
fail:
ec_config_free(config);
fail:
ec_config_free(config);
- ec_node_free(
gen_
node);
+ ec_node_free(node);
return NULL;
}
return NULL;
}
@@
-154,11
+152,11
@@
static int ec_node_any_testcase(void)
return -1;
}
testres |= EC_TEST_CHECK_COMPLETE(node,
return -1;
}
testres |= EC_TEST_CHECK_COMPLETE(node,
- "", EC_
NODE_ENDLIST
,
- EC_
NODE_ENDLIST
);
+ "", EC_
VA_END
,
+ EC_
VA_END
);
testres |= EC_TEST_CHECK_COMPLETE(node,
testres |= EC_TEST_CHECK_COMPLETE(node,
- "foo", EC_
NODE_ENDLIST
,
- EC_
NODE_ENDLIST
);
+ "foo", EC_
VA_END
,
+ EC_
VA_END
);
ec_node_free(node);
return testres;
ec_node_free(node);
return testres;