diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2018-11-25 14:41:38 -0200 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2018-11-26 15:53:15 -0200 |
| commit | 25c780a32a0de196688b3f08e82e6a56d7b49b2f (patch) | |
| tree | dd5b8b0e087a70b21d6472140d5688791efae177 /lib/if.c | |
| parent | 3f662078965405c6363dcecc2cc43c658c108229 (diff) | |
lib: make yang_dnode_get_entry() more flexible
Add the "abort_if_not_found" parameter to the yang_dnode_get_entry()
function instead of always aborting when an user pointer is not
found. This will make it possible, for example, to use this function
during the validation phase of a configuration transaction. Callers
will only need to check if the function returned NULL or not,
since new configuration objects (if any) won't be created until
the NB_EV_APPLY phase of the transaction.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1338,7 +1338,7 @@ static int lib_interface_delete(enum nb_event event, { struct interface *ifp; - ifp = yang_dnode_get_entry(dnode); + ifp = yang_dnode_get_entry(dnode, true); switch (event) { case NB_EV_VALIDATE: @@ -1372,7 +1372,7 @@ static int lib_interface_description_modify(enum nb_event event, if (event != NB_EV_APPLY) return NB_OK; - ifp = yang_dnode_get_entry(dnode); + ifp = yang_dnode_get_entry(dnode, true); if (ifp->desc) XFREE(MTYPE_TMP, ifp->desc); description = yang_dnode_get_string(dnode, NULL); @@ -1389,7 +1389,7 @@ static int lib_interface_description_delete(enum nb_event event, if (event != NB_EV_APPLY) return NB_OK; - ifp = yang_dnode_get_entry(dnode); + ifp = yang_dnode_get_entry(dnode, true); if (ifp->desc) XFREE(MTYPE_TMP, ifp->desc); |
