From 27bc0b870cd1eed7e5752aed8b6ba0bd695987d9 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sun, 9 Jul 2023 16:55:10 -0400 Subject: [PATCH] lib: yang: restore old API use now that it's fixed 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 --- lib/yang.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/yang.c b/lib/yang.c index a904482dfecb..c04a90db7305 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -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); @@ -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; }