Skip to content

Commit

Permalink
lib: Fix LYD_NEW_PATH_OUTPUT issue to support libyang v3.x
Browse files Browse the repository at this point in the history
Fix the LYD_NEW_PATH_OUTPUT undeclared error to support the latest libyang v3.x version,
and also compatible with old version.

Signed-off-by: Lu Mao <[email protected]>
(cherry picked from commit 87c9060)
  • Loading branch information
oplklum authored and mergify[bot] committed Sep 9, 2024
1 parent c60f439 commit b346f80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/yang.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure");
#define yang_lyd_find_xpath3(ctx_node, tree, xpath, format, prefix_data, vars, \
set) \
lyd_find_xpath3(ctx_node, tree, xpath, vars, set)

#ifndef LYD_NEW_VAL_OUTPUT
#define LYD_NEW_VAL_OUTPUT LYD_NEW_PATH_OUTPUT
#endif

#else
#define yang_lyd_find_xpath3(ctx_node, tree, xpath, format, prefix_data, vars, \
set) \
Expand Down Expand Up @@ -671,7 +676,7 @@ void yang_dnode_rpc_output_add(struct lyd_node *output, const char *xpath,
LY_ERR err;

err = lyd_new_path(output, ly_native_ctx, xpath, value,
LYD_NEW_PATH_OUTPUT | LYD_NEW_PATH_UPDATE, NULL);
LYD_NEW_VAL_OUTPUT | LYD_NEW_PATH_UPDATE, NULL);
assert(err == LY_SUCCESS);
}

Expand Down

0 comments on commit b346f80

Please sign in to comment.