mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-29 20:23:01 +02:00
libsrx: add lydx_get_bool to parse bool values
This commit is contained in:
committed by
Joachim Wiberg
parent
2b154c1825
commit
2e8ba44abc
@@ -176,6 +176,16 @@ const char *lydx_get_attrf(struct lyd_node *sibling, const char *namefmt, ...)
|
||||
return val;
|
||||
}
|
||||
|
||||
bool lydx_get_bool(struct lyd_node *parent, const char *name)
|
||||
{
|
||||
const char *value = lydx_get_cattr(parent,name);
|
||||
if(!value)
|
||||
return false;
|
||||
if(!strcmp(value, "true"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int lydx_new_path(const struct ly_ctx *ctx, struct lyd_node **parent,
|
||||
char *xpath_base, char *node, const char *fmt, ...)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,8 @@ const char *lydx_get_mattr(struct lyd_node *node, const char *name);
|
||||
const char *lydx_get_attr(struct lyd_node *sibling, const char *name);
|
||||
const char *lydx_get_cattr(struct lyd_node *parent, const char *name);
|
||||
|
||||
bool lydx_get_bool(struct lyd_node *parent, const char *name);
|
||||
|
||||
const char *lydx_get_vattrf(struct lyd_node *sibling, const char *namefmt, va_list ap);
|
||||
const char *lydx_get_attrf(struct lyd_node *sibling, const char *namefmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
Reference in New Issue
Block a user