Skip to content

Commit

Permalink
lib: yang: restore old API use now that it's fixed
Browse files Browse the repository at this point in the history
This also avoids a bug in the workaround function if the set variable
wasn't set to NULL the Debug version of libyang would sigsegv.

Signed-off-by: Christian Hopps <[email protected]>
  • Loading branch information
choppsv1 committed Sep 26, 2023
1 parent 02a85ab commit 27bc0b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/yang.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ void yang_snode_get_path(const struct lysc_node *snode,
struct lysc_node *yang_find_snode(struct ly_ctx *ly_ctx, const char *xpath,
uint32_t options)
{
#if 1
struct lysc_node *snode;
struct ly_set *set;

snode = (struct lysc_node *)lys_find_path(ly_ctx, NULL, xpath, 0);
#else
struct lysc_node *snode;
struct ly_set *set = NULL;
LY_ERR err;

err = lys_find_xpath(ly_native_ctx, NULL, xpath, options, &set);
Expand All @@ -264,6 +269,7 @@ struct lysc_node *yang_find_snode(struct ly_ctx *ly_ctx, const char *xpath,

snode = set->snodes[0];
ly_set_free(set, NULL);
#endif

return snode;
}
Expand Down

0 comments on commit 27bc0b8

Please sign in to comment.