summaryrefslogtreecommitdiff
path: root/lib/yang.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-02 22:07:07 -0200
committerRenato Westphal <renato@opensourcerouting.org>2018-11-26 17:35:58 -0200
commitdb452508bf3d808a33b3fc04c946d8cc2939bbb7 (patch)
tree2dbc95e01dd6e2f4926e34e33d89475809e12dd5 /lib/yang.c
parent5e02643a64fb6aaaf95f6f9049020f392b5563d5 (diff)
lib, tools: use CHECK_FLAG/SET_FLAG more often in the northbound code
Cosmetic change to improve code readability a bit. No binary changes. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 660a54a22a..7daef79198 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -132,7 +132,7 @@ static void yang_snodes_iterate(const struct lys_node *snode,
case LYS_CASE:
case LYS_INPUT:
case LYS_OUTPUT:
- if (snode->flags & LYS_IMPLICIT)
+ if (CHECK_FLAG(snode->flags, LYS_IMPLICIT))
goto next;
break;
default:
@@ -183,7 +183,7 @@ next:
* YANG leafs and leaf-lists can't have child nodes, and trying to
* access snode->child is undefined behavior.
*/
- if (snode->nodetype & (LYS_LEAF | LYS_LEAFLIST))
+ if (CHECK_FLAG(snode->nodetype, LYS_LEAF | LYS_LEAFLIST))
return;
LY_TREE_FOR (snode->child, child) {
@@ -324,7 +324,7 @@ const struct lys_type *yang_snode_get_type(const struct lys_node *snode)
struct lys_node_leaf *sleaf = (struct lys_node_leaf *)snode;
struct lys_type *type;
- if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST)))
+ if (!CHECK_FLAG(sleaf->nodetype, LYS_LEAF | LYS_LEAFLIST))
return NULL;
type = &sleaf->type;
@@ -440,7 +440,7 @@ bool yang_dnode_is_default_recursive(const struct lyd_node *dnode)
struct lyd_node *root, *next, *dnode_iter;
snode = dnode->schema;
- if (snode->nodetype & (LYS_LEAF | LYS_LEAFLIST))
+ if (CHECK_FLAG(snode->nodetype, LYS_LEAF | LYS_LEAFLIST))
return yang_dnode_is_default(dnode, NULL);
if (!yang_dnode_is_default(dnode, NULL))
@@ -466,7 +466,7 @@ void yang_dnode_change_leaf(struct lyd_node *dnode, const char *value)
void yang_dnode_set_entry(const struct lyd_node *dnode, void *entry)
{
- assert(dnode->schema->nodetype & (LYS_LIST | LYS_CONTAINER));
+ assert(CHECK_FLAG(dnode->schema->nodetype, LYS_LIST | LYS_CONTAINER));
lyd_set_private(dnode, entry);
}