conf: add function to get child with default

pull/3157/head
Eric Leblond 8 years ago committed by Victor Julien
parent 4bfa3aeaf9
commit ba0899a77f

@ -399,6 +399,19 @@ int ConfGetChildValue(const ConfNode *base, const char *name, const char **vptr)
}
}
ConfNode *ConfGetChildWithDefault(const ConfNode *base, const ConfNode *dflt,
const char *name)
{
ConfNode *node = ConfNodeLookupChild(base, name);
if (node != NULL)
return node;
/* Get 'default' value */
if (dflt) {
return ConfNodeLookupChild(dflt, name);
}
return NULL;
}
int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt,
const char *name, const char **vptr)

@ -82,6 +82,7 @@ int ConfValIsFalse(const char *val);
void ConfNodePrune(ConfNode *node);
int ConfRemove(const char *name);
ConfNode *ConfGetChildWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name);
ConfNode *ConfNodeLookupKeyValue(const ConfNode *base, const char *key, const char *value);
int ConfGetChildValue(const ConfNode *base, const char *name, const char **vptr);
int ConfGetChildValueInt(const ConfNode *base, const char *name, intmax_t *val);

Loading…
Cancel
Save