plugins types FEATURE sort callback in boolean
diff --git a/src/plugins_types.h b/src/plugins_types.h
index 66ba18e..4ca43f5 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -790,6 +790,12 @@
const struct lyd_value *val2);
/**
+ * @brief Implementation of ::lyplg_type_sort_clb for the built-in boolean type.
+ */
+LIBYANG_API_DEF int lyplg_type_sort_boolean(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 boolean type.
*/
LIBYANG_API_DECL const void *lyplg_type_print_boolean(const struct ly_ctx *ctx, const struct lyd_value *value,
diff --git a/src/plugins_types/boolean.c b/src/plugins_types/boolean.c
index ea8f7d2..3e055d2 100644
--- a/src/plugins_types/boolean.c
+++ b/src/plugins_types/boolean.c
@@ -112,6 +112,18 @@
return LY_SUCCESS;
}
+LIBYANG_API_DEF int
+lyplg_type_sort_boolean(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *val1, const struct lyd_value *val2)
+{
+ if (val1->boolean > val2->boolean) {
+ return 1;
+ } else if (val1->boolean < val2->boolean) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
LIBYANG_API_DEF const void *
lyplg_type_print_boolean(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
@@ -151,7 +163,7 @@
.plugin.store = lyplg_type_store_boolean,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_boolean,
- .plugin.sort = NULL,
+ .plugin.sort = lyplg_type_sort_boolean,
.plugin.print = lyplg_type_print_boolean,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple,