From b92690e627005a3bad8df5eeb59d8f0997063c0b Mon Sep 17 00:00:00 2001 From: Stefan Gula Date: Thu, 18 Jan 2024 09:45:04 +0100 Subject: [PATCH] Renamed of forgotten API --- src/tree_data.c | 6 +++--- src/tree_data.h | 6 +++--- src/tree_data_free.c | 4 ++-- tests/utests/data/test_tree_data.c | 28 ++++++++++++++-------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/tree_data.c b/src/tree_data.c index d17e01842..1bf5d0f14 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -3316,7 +3316,7 @@ lyd_get_or_create_leafref_links_record(const struct lyd_node_term *node, struct } LIBYANG_API_DEF LY_ERR -lyd_get_term_nodes_ext_record(const struct lyd_node_term *node, struct lyd_leafref_links_rec **record) +lyd_get_leafref_links(const struct lyd_node_term *node, struct lyd_leafref_links_rec **record) { return lyd_get_or_create_leafref_links_record(node, record, 0); } @@ -3402,7 +3402,7 @@ lyd_unlink_leafref_node(const struct lyd_node_term *node, const struct lyd_node_ return LY_EDENIED; } - ret = lyd_get_term_nodes_ext_record(node, &rec); + ret = lyd_get_leafref_links(node, &rec); if (ret == LY_SUCCESS) { LY_ARRAY_REMOVE_VALUE(rec->leafref_nodes, leafref_node); if ((LY_ARRAY_COUNT(rec->leafref_nodes) == 0) && (rec->target_node == NULL)) { @@ -3412,7 +3412,7 @@ lyd_unlink_leafref_node(const struct lyd_node_term *node, const struct lyd_node_ return ret; } - ret = lyd_get_term_nodes_ext_record(leafref_node, &rec); + ret = lyd_get_leafref_links(leafref_node, &rec); if (ret == LY_SUCCESS) { rec->target_node = NULL; if ((LY_ARRAY_COUNT(rec->leafref_nodes) == 0) && (rec->target_node == NULL)) { diff --git a/src/tree_data.h b/src/tree_data.h index 54b90bf7c..1be2aff54 100644 --- a/src/tree_data.h +++ b/src/tree_data.h @@ -2718,16 +2718,16 @@ LIBYANG_API_DECL LY_ERR ly_time_str2ts(const char *value, struct timespec *ts); LIBYANG_API_DECL LY_ERR ly_time_ts2str(const struct timespec *ts, char **str); /** - * @brief Gets the term data node extension record for given node + * @brief Gets the leafref links record for given node * * This API requires usage of LY_CTX_LEAFREF_LINKING context flag. * * @param[in] node The term data node. - * @param[out] record The term data node extension record + * @param[out] record The leafref links record * @return LY_SUCCESS on success. * @return LY_ERR value on error. */ -LIBYANG_API_DECL LY_ERR lyd_get_term_nodes_ext_record(const struct lyd_node_term *node, struct lyd_leafref_links_rec **record); +LIBYANG_API_DECL LY_ERR lyd_get_leafref_links(const struct lyd_node_term *node, struct lyd_leafref_links_rec **record); /** * @brief Traverse through data tree including root node siblings and adds leafrefs links to the given nodes diff --git a/src/tree_data_free.c b/src/tree_data_free.c index 81a3759d4..790022ff9 100644 --- a/src/tree_data_free.c +++ b/src/tree_data_free.c @@ -148,7 +148,7 @@ lyd_free_leafref_links_rec(struct lyd_leafref_links_rec *rec) /* remove stored leafref nodes */ LY_ARRAY_FOR(rec->leafref_nodes, u) { - if (lyd_get_term_nodes_ext_record(rec->leafref_nodes[u], &leafref_rec) == LY_SUCCESS) { + if (lyd_get_leafref_links(rec->leafref_nodes[u], &leafref_rec) == LY_SUCCESS) { leafref_rec->target_node = NULL; if ((LY_ARRAY_COUNT(leafref_rec->leafref_nodes) == 0) && (leafref_rec->target_node == NULL)) { lyd_free_leafref_nodes(rec->leafref_nodes[u]); @@ -172,7 +172,7 @@ lyd_free_leafref_nodes(const struct lyd_node_term *node) assert(node); - if (lyd_get_term_nodes_ext_record(node, &rec) != LY_SUCCESS) { + if (lyd_get_leafref_links(node, &rec) != LY_SUCCESS) { return; } diff --git a/tests/utests/data/test_tree_data.c b/tests/utests/data/test_tree_data.c index fc93e35bd..f451571fa 100644 --- a/tests/utests/data/test_tree_data.c +++ b/tests/utests/data/test_tree_data.c @@ -649,36 +649,36 @@ test_data_leafref_nodes(void **state) } /* verify state after leafref plugin validation */ - assert_int_equal(LY_SUCCESS, lyd_get_term_nodes_ext_record(target_node, &rec)); + assert_int_equal(LY_SUCCESS, lyd_get_leafref_links(target_node, &rec)); assert_int_equal(1, LY_ARRAY_COUNT(rec->leafref_nodes)); - assert_int_equal(LY_SUCCESS, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_SUCCESS, lyd_get_leafref_links(leafref_node, &rec)); assert_ptr_equal(rec->target_node, target_node); /* value modification of target */ assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)target_node, "ASD")); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(target_node, &rec)); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(target_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(leafref_node, &rec)); /* change back to original value */ assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)target_node, "asd")); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(target_node, &rec)); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(target_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(leafref_node, &rec)); /* linking the whole tree again */ assert_int_equal(LY_SUCCESS, lyd_link_leafref_node_tree(tree)); - assert_int_equal(LY_SUCCESS, lyd_get_term_nodes_ext_record(target_node, &rec)); + assert_int_equal(LY_SUCCESS, lyd_get_leafref_links(target_node, &rec)); assert_int_equal(1, LY_ARRAY_COUNT(rec->leafref_nodes)); - assert_int_equal(LY_SUCCESS, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_SUCCESS, lyd_get_leafref_links(leafref_node, &rec)); assert_ptr_equal(rec->target_node, target_node); /* value modification of leafref */ assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)leafref_node, "qwe")); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(target_node, &rec)); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(target_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(leafref_node, &rec)); assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)leafref_node, "asd")); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(target_node, &rec)); - assert_int_equal(LY_ENOTFOUND, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(target_node, &rec)); + assert_int_equal(LY_ENOTFOUND, lyd_get_leafref_links(leafref_node, &rec)); /* linking the whole tree again */ assert_int_equal(LY_SUCCESS, lyd_link_leafref_node_tree(tree)); - assert_int_equal(LY_SUCCESS, lyd_get_term_nodes_ext_record(target_node, &rec)); + assert_int_equal(LY_SUCCESS, lyd_get_leafref_links(target_node, &rec)); assert_int_equal(1, LY_ARRAY_COUNT(rec->leafref_nodes)); - assert_int_equal(LY_SUCCESS, lyd_get_term_nodes_ext_record(leafref_node, &rec)); + assert_int_equal(LY_SUCCESS, lyd_get_leafref_links(leafref_node, &rec)); assert_ptr_equal(rec->target_node, target_node); /* freeing whole tree */ lyd_free_all(tree);