diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2018-11-03 01:07:07 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2018-11-26 20:35:58 +0100 |
commit | db452508bf3d808a33b3fc04c946d8cc2939bbb7 (patch) | |
tree | 2dbc95e01dd6e2f4926e34e33d89475809e12dd5 /lib/northbound.c | |
parent | lib: make it possible to create YANG data nodes containing state data (diff) | |
download | frr-db452508bf3d808a33b3fc04c946d8cc2939bbb7.tar.xz frr-db452508bf3d808a33b3fc04c946d8cc2939bbb7.zip |
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/northbound.c')
-rw-r--r-- | lib/northbound.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index 21bbc63f6..2fabae22b 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -380,7 +380,8 @@ static void nb_config_diff(const struct nb_config *config1, nb_config_diff_add_change(changes, operation, dnode); if (type == LYD_DIFF_CREATED - && (dnode->schema->nodetype & (LYS_CONTAINER | LYS_LIST))) + && CHECK_FLAG(dnode->schema->nodetype, + LYS_CONTAINER | LYS_LIST)) nb_config_diff_new_subtree(dnode, changes); } @@ -898,7 +899,7 @@ bool nb_operation_is_valid(enum nb_operation operation, switch (operation) { case NB_OP_CREATE: - if (!(snode->flags & LYS_CONFIG_W)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_W)) return false; switch (snode->nodetype) { @@ -920,7 +921,7 @@ bool nb_operation_is_valid(enum nb_operation operation, } return true; case NB_OP_MODIFY: - if (!(snode->flags & LYS_CONFIG_W)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_W)) return false; switch (snode->nodetype) { @@ -938,7 +939,7 @@ bool nb_operation_is_valid(enum nb_operation operation, } return true; case NB_OP_DELETE: - if (!(snode->flags & LYS_CONFIG_W)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_W)) return false; switch (snode->nodetype) { @@ -957,7 +958,8 @@ bool nb_operation_is_valid(enum nb_operation operation, return true; if (sleaf->when) return true; - if ((sleaf->flags & LYS_MAND_TRUE) || sleaf->dflt) + if (CHECK_FLAG(sleaf->flags, LYS_MAND_TRUE) + || sleaf->dflt) return false; break; case LYS_CONTAINER: @@ -973,13 +975,13 @@ bool nb_operation_is_valid(enum nb_operation operation, } return true; case NB_OP_MOVE: - if (!(snode->flags & LYS_CONFIG_W)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_W)) return false; switch (snode->nodetype) { case LYS_LIST: case LYS_LEAFLIST: - if (!(snode->flags & LYS_USERORDERED)) + if (!CHECK_FLAG(snode->flags, LYS_USERORDERED)) return false; break; default: @@ -987,11 +989,11 @@ bool nb_operation_is_valid(enum nb_operation operation, } return true; case NB_OP_APPLY_FINISH: - if (!(snode->flags & LYS_CONFIG_W)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_W)) return false; return true; case NB_OP_GET_ELEM: - if (!(snode->flags & LYS_CONFIG_R)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_R)) return false; switch (snode->nodetype) { @@ -1009,7 +1011,7 @@ bool nb_operation_is_valid(enum nb_operation operation, case NB_OP_GET_NEXT: case NB_OP_GET_KEYS: case NB_OP_LOOKUP_ENTRY: - if (!(snode->flags & LYS_CONFIG_R)) + if (!CHECK_FLAG(snode->flags, LYS_CONFIG_R)) return false; switch (snode->nodetype) { @@ -1020,7 +1022,7 @@ bool nb_operation_is_valid(enum nb_operation operation, } return true; case NB_OP_RPC: - if (snode->flags & (LYS_CONFIG_W | LYS_CONFIG_R)) + if (CHECK_FLAG(snode->flags, LYS_CONFIG_W | LYS_CONFIG_R)) return false; switch (snode->nodetype) { |