From 670385f9595014dc9307615fa6e929b46dba026b Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Sep 2024 14:04:43 +0200 Subject: [PATCH] plugins types REFACTOR removed redundant instid callbacks --- src/plugins_types.h | 12 ------------ src/plugins_types/instanceid.c | 16 ++-------------- src/plugins_types/node_instanceid.c | 8 ++++---- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/src/plugins_types.h b/src/plugins_types.h index 95e1a2e6c..06acc3802 100644 --- a/src/plugins_types.h +++ b/src/plugins_types.h @@ -950,18 +950,6 @@ LIBYANG_API_DECL LY_ERR lyplg_type_store_instanceid(const struct ly_ctx *ctx, co LIBYANG_API_DECL LY_ERR lyplg_type_validate_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node, const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err); -/** - * @brief Implementation of ::lyplg_type_compare_clb for the built-in instance-identifier type. - */ -LIBYANG_API_DECL LY_ERR lyplg_type_compare_instanceid(const struct ly_ctx *ctx, const struct lyd_value *val1, - const struct lyd_value *val2); - -/** - * @brief Implementation of ::lyplg_type_sort_clb for the built-in instance-identifier type. - */ -LIBYANG_API_DEF int lyplg_type_sort_instanceid(const struct ly_ctx *ctx, const struct lyd_value *val1, - const struct lyd_value *val2); - /** * @brief Implementation of ::lyplg_type_print_clb for the built-in instance-identifier type. */ diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c index 00ad45a98..b903b6fcf 100644 --- a/src/plugins_types/instanceid.c +++ b/src/plugins_types/instanceid.c @@ -252,18 +252,6 @@ lyplg_type_validate_instanceid(const struct ly_ctx *ctx, const struct lysc_type return LY_SUCCESS; } -LIBYANG_API_DEF LY_ERR -lyplg_type_compare_instanceid(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2) -{ - return lyplg_type_compare_simple(ctx, val1, val2); -} - -LIBYANG_API_DEF int -lyplg_type_sort_instanceid(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2) -{ - return lyplg_type_sort_simple(ctx, val1, val2); -} - LIBYANG_API_DEF const void * lyplg_type_print_instanceid(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, size_t *value_len) @@ -338,8 +326,8 @@ const struct lyplg_type_record plugins_instanceid[] = { .plugin.id = "libyang 2 - instance-identifier, version 1", .plugin.store = lyplg_type_store_instanceid, .plugin.validate = lyplg_type_validate_instanceid, - .plugin.compare = lyplg_type_compare_instanceid, - .plugin.sort = lyplg_type_sort_instanceid, + .plugin.compare = lyplg_type_compare_simple, + .plugin.sort = lyplg_type_sort_simple, .plugin.print = lyplg_type_print_instanceid, .plugin.duplicate = lyplg_type_dup_instanceid, .plugin.free = lyplg_type_free_instanceid, diff --git a/src/plugins_types/node_instanceid.c b/src/plugins_types/node_instanceid.c index 21448e34e..7c80e3053 100644 --- a/src/plugins_types/node_instanceid.c +++ b/src/plugins_types/node_instanceid.c @@ -312,8 +312,8 @@ const struct lyplg_type_record plugins_node_instanceid[] = { .plugin.id = "libyang 2 - node-instance-identifier, version 1", .plugin.store = lyplg_type_store_node_instanceid, .plugin.validate = NULL, - .plugin.compare = lyplg_type_compare_instanceid, - .plugin.sort = lyplg_type_sort_instanceid, + .plugin.compare = lyplg_type_compare_simple, + .plugin.sort = lyplg_type_sort_simple, .plugin.print = lyplg_type_print_node_instanceid, .plugin.duplicate = lyplg_type_dup_instanceid, .plugin.free = lyplg_type_free_instanceid, @@ -327,8 +327,8 @@ const struct lyplg_type_record plugins_node_instanceid[] = { .plugin.id = "libyang 2 - node-instance-identifier, version 1", .plugin.store = lyplg_type_store_node_instanceid, .plugin.validate = NULL, - .plugin.compare = lyplg_type_compare_instanceid, - .plugin.sort = lyplg_type_sort_instanceid, + .plugin.compare = lyplg_type_compare_simple, + .plugin.sort = lyplg_type_sort_simple, .plugin.print = lyplg_type_print_node_instanceid, .plugin.duplicate = lyplg_type_dup_instanceid, .plugin.free = lyplg_type_free_instanceid,