From 0913d9fc0ea4975eb0dd37f5ca84af2264833687 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sat, 27 Jul 2024 01:07:57 -0400 Subject: [PATCH] lib: constify yang_resolve_snode_xpath results Signed-off-by: Christian Hopps ang --- lib/northbound.c | 2 +- lib/yang.c | 2 +- lib/yang.h | 3 ++- mgmtd/mgmt_fe_adapter.c | 4 +--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/northbound.c b/lib/northbound.c index 0bc79d0277..63062ee336 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -178,7 +178,7 @@ struct nb_node *nb_node_find(const char *path) struct nb_node **nb_nodes_find(const char *xpath) { - struct lysc_node **snodes = NULL; + const struct lysc_node **snodes = NULL; struct nb_node **nb_nodes = NULL; bool simple; LY_ERR err; diff --git a/lib/yang.c b/lib/yang.c index 6c1aed00cc..14d5b118c6 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -286,7 +286,7 @@ void yang_snode_get_path(const struct lysc_node *snode, } LY_ERR yang_resolve_snode_xpath(struct ly_ctx *ly_ctx, const char *xpath, - struct lysc_node ***snodes, bool *simple) + const struct lysc_node ***snodes, bool *simple) { struct lysc_node *snode; struct ly_set *set; diff --git a/lib/yang.h b/lib/yang.h index 57131f478b..c4fc78b8ae 100644 --- a/lib/yang.h +++ b/lib/yang.h @@ -827,7 +827,8 @@ extern int yang_xpath_pop_node(char *xpath); * Return: a libyang error or LY_SUCCESS. */ extern LY_ERR yang_resolve_snode_xpath(struct ly_ctx *ly_ctx, const char *xpath, - struct lysc_node ***snodes, bool *simple); + const struct lysc_node ***snodes, + bool *simple); /* * Libyang future functions diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c index 09d1910cee..fc35e74610 100644 --- a/mgmtd/mgmt_fe_adapter.c +++ b/mgmtd/mgmt_fe_adapter.c @@ -1282,8 +1282,7 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session, void *__msg, size_t msg_len) { struct mgmt_msg_get_data *msg = __msg; - struct lysc_node **snodes = NULL; - char *xpath_resolved = NULL; + const struct lysc_node **snodes = NULL; uint64_t req_id = msg->req_id; Mgmtd__DatastoreId ds_id; uint64_t clients; @@ -1395,7 +1394,6 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session, } done: darr_free(snodes); - darr_free(xpath_resolved); } static void fe_adapter_handle_edit(struct mgmt_fe_session_ctx *session, -- 2.39.5