From ed277585ea6342d4146915549634b9c9998e5994 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 28 Mar 2024 09:55:31 +0100 Subject: [PATCH] libyang UPDATE compatibility macros Refs #2205 --- src/libyang.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libyang.h b/src/libyang.h index e5ed1147a..13f31638d 100644 --- a/src/libyang.h +++ b/src/libyang.h @@ -37,6 +37,16 @@ extern "C" { #include "tree_data.h" #include "tree_schema.h" +/** + * @brief libyang v3 compatibility macros with v2. + */ +#define ly_strerrcode ly_strerr +#define ly_last_errmsg ly_last_logmsg +#define ly_errcode(ctx) (ly_err_last(ctx) ? ly_err_last(ctx)->err : 0) +#define ly_errmsg(ctx) (ly_err_last(ctx) ? ly_err_last(ctx)->msg : NULL) +#define ly_errpath(ctx) (ly_err_last(ctx) ? (ly_err_last(ctx)->data_path ? ly_err_last(ctx)->data_path : ly_err_last(ctx)->schema_path) : NULL) +#define ly_vecode(ctx) (ly_err_last(ctx) ? ly_err_last(ctx)->vecode : 0) + /* * The following headers are supposed to be included explicitly: * - hash_table.h