plugins types CHANGE remove basetype
It is redundant.
diff --git a/src/plugins_types.h b/src/plugins_types.h
index 99b2b93..7479d1a 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -455,14 +455,14 @@
* functionality.
*/
struct lyplg_type {
- LY_DATA_TYPE type; /**< implemented type, use ::LY_TYPE_UNKNOWN for derived data types */
+ const char *id; /**< Plugin identification (mainly for distinguish incompatible versions when
+ used by external tools) */
lyplg_type_store_clb store; /**< store and canonize the value in the type-specific way */
lyplg_type_validate_clb validate; /**< optional, validate the value in the type-specific way in data */
lyplg_type_compare_clb compare; /**< comparison callback to compare 2 values of the same type */
lyplg_type_print_clb print; /**< printer callback to get string representing the value */
lyplg_type_dup_clb duplicate; /**< data duplication callback */
lyplg_type_free_clb free; /**< optional function to free the type-spceific way stored value */
- const char *id; /**< Plugin identification (mainly for distinguish incompatible versions when used by external tools) */
};
struct lyplg_type_record {
diff --git a/src/plugins_types/binary.c b/src/plugins_types/binary.c
index e889e56..9176929 100644
--- a/src/plugins_types/binary.c
+++ b/src/plugins_types/binary.c
@@ -139,7 +139,6 @@
.name = LY_TYPE_BINARY_STR,
.plugin.id = "libyang 2 - binary, version 1",
- .plugin.type = LY_TYPE_BINARY,
.plugin.store = lyplg_type_store_binary,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/bits.c b/src/plugins_types/bits.c
index 0fe30e9..b5a3e43 100644
--- a/src/plugins_types/bits.c
+++ b/src/plugins_types/bits.c
@@ -235,7 +235,6 @@
.name = LY_TYPE_BITS_STR,
.plugin.id = "libyang 2 - bits, version 1",
- .plugin.type = LY_TYPE_BITS,
.plugin.store = lyplg_type_store_bits,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/boolean.c b/src/plugins_types/boolean.c
index 930502d..83a6b13 100644
--- a/src/plugins_types/boolean.c
+++ b/src/plugins_types/boolean.c
@@ -84,7 +84,6 @@
.name = LY_TYPE_BOOL_STR,
.plugin.id = "libyang 2 - boolean, version 1",
- .plugin.type = LY_TYPE_BOOL,
.plugin.store = lyplg_type_store_boolean,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/decimal64.c b/src/plugins_types/decimal64.c
index 1496e6a..368254a 100644
--- a/src/plugins_types/decimal64.c
+++ b/src/plugins_types/decimal64.c
@@ -112,7 +112,6 @@
.name = LY_TYPE_DEC64_STR,
.plugin.id = "libyang 2 - decimal64, version 1",
- .plugin.type = LY_TYPE_DEC64,
.plugin.store = lyplg_type_store_decimal64,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/empty.c b/src/plugins_types/empty.c
index 63722e5..a26347d 100644
--- a/src/plugins_types/empty.c
+++ b/src/plugins_types/empty.c
@@ -89,7 +89,6 @@
.name = LY_TYPE_EMPTY_STR,
.plugin.id = "libyang 2 - empty, version 1",
- .plugin.type = LY_TYPE_EMPTY,
.plugin.store = lyplg_type_store_empty,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_empty,
diff --git a/src/plugins_types/enumeration.c b/src/plugins_types/enumeration.c
index 16156dc..cb93c7f 100644
--- a/src/plugins_types/enumeration.c
+++ b/src/plugins_types/enumeration.c
@@ -90,7 +90,6 @@
.name = LY_TYPE_ENUM_STR,
.plugin.id = "libyang 2 - enumeration, version 1",
- .plugin.type = LY_TYPE_ENUM,
.plugin.store = lyplg_type_store_enum,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/identityref.c b/src/plugins_types/identityref.c
index 1fac62d..4029654 100644
--- a/src/plugins_types/identityref.c
+++ b/src/plugins_types/identityref.c
@@ -188,7 +188,6 @@
.name = LY_TYPE_IDENT_STR,
.plugin.id = "libyang 2 - identityref, version 1",
- .plugin.type = LY_TYPE_IDENT,
.plugin.store = lyplg_type_store_identityref,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_identityref,
diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c
index b29401f..0afb4a8 100644
--- a/src/plugins_types/instanceid.c
+++ b/src/plugins_types/instanceid.c
@@ -304,7 +304,6 @@
.name = LY_TYPE_INST_STR,
.plugin.id = "libyang 2 - instance-identifier, version 1",
- .plugin.type = LY_TYPE_INST,
.plugin.store = lyplg_type_store_instanceid,
.plugin.validate = lyplg_type_validate_instanceid,
.plugin.compare = lyplg_type_compare_instanceid,
diff --git a/src/plugins_types/integer.c b/src/plugins_types/integer.c
index 7c1354c..fec0bc1 100644
--- a/src/plugins_types/integer.c
+++ b/src/plugins_types/integer.c
@@ -189,7 +189,6 @@
.name = LY_TYPE_UINT8_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_UINT8,
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -202,7 +201,6 @@
.name = LY_TYPE_UINT16_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_UINT16,
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -215,7 +213,6 @@
.name = LY_TYPE_UINT32_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_UINT32,
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -228,7 +225,6 @@
.name = LY_TYPE_UINT64_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_UINT64,
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -241,7 +237,6 @@
.name = LY_TYPE_INT8_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_INT8,
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -254,7 +249,6 @@
.name = LY_TYPE_INT16_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_INT16,
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -267,7 +261,6 @@
.name = LY_TYPE_INT32_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_INT32,
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
@@ -280,7 +273,6 @@
.name = LY_TYPE_INT64_STR,
.plugin.id = "libyang 2 - integers, version 1",
- .plugin.type = LY_TYPE_INT64,
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/leafref.c b/src/plugins_types/leafref.c
index 7c3036d..740449e 100644
--- a/src/plugins_types/leafref.c
+++ b/src/plugins_types/leafref.c
@@ -124,7 +124,6 @@
.name = LY_TYPE_LEAFREF_STR,
.plugin.id = "libyang 2 - leafref, version 1",
- .plugin.type = LY_TYPE_LEAFREF,
.plugin.store = lyplg_type_store_leafref,
.plugin.validate = lyplg_type_validate_leafref,
.plugin.compare = lyplg_type_compare_leafref,
diff --git a/src/plugins_types/string.c b/src/plugins_types/string.c
index c7a4904..f20a05c 100644
--- a/src/plugins_types/string.c
+++ b/src/plugins_types/string.c
@@ -45,7 +45,7 @@
char buf[LY_NUMBER_MAXLEN];
size_t char_count = ly_utf8len(value, value_len);
- /* value_len is in bytes, but we need number of chaarcters here */
+ /* value_len is in bytes, but we need number of characters here */
snprintf(buf, LY_NUMBER_MAXLEN, "%zu", char_count);
ret = lyplg_type_validate_range(LY_TYPE_BINARY, type_str->length, char_count, buf, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
@@ -88,7 +88,6 @@
.name = LY_TYPE_STRING_STR,
.plugin.id = "libyang 2 - string, version 1",
- .plugin.type = LY_TYPE_STRING,
.plugin.store = lyplg_type_store_string,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index 2e00afd..58fbbd6 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -245,7 +245,6 @@
.name = LY_TYPE_UNION_STR,
.plugin.id = "libyang 2 - union,version 1",
- .plugin.type = LY_TYPE_UNION,
.plugin.store = lyplg_type_store_union,
.plugin.validate = lyplg_type_validate_union,
.plugin.compare = lyplg_type_compare_union,
diff --git a/tests/plugins/simple.c b/tests/plugins/simple.c
index 18c289e..8f8cac8 100644
--- a/tests/plugins/simple.c
+++ b/tests/plugins/simple.c
@@ -75,7 +75,6 @@
.name = "note",
.plugin.id = "libyang 2 - simple test, version 1",
- .plugin.type = LY_TYPE_UNKNOWN,
.plugin.store = lyplg_type_store_string,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
diff --git a/tests/utests/types/bits.c b/tests/utests/types/bits.c
index 1e6b8f7..e674ea9 100644
--- a/tests/utests/types/bits.c
+++ b/tests/utests/types/bits.c
@@ -769,7 +769,6 @@
lysc_type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
/* check proper type */
- assert_int_equal(LY_TYPE_BITS, type->type);
assert_string_equal("libyang 2 - bits, version 1", type->id);
/* check store
@@ -897,7 +896,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_BITS);
assert_int_equal(LY_SUCCESS, type->compare(&diff_type_val, &(values[2])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
@@ -910,7 +908,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_BITS);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[2])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
@@ -923,7 +920,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_STRING);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[2])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
type->free(UTEST_LYCTX, &(diff_type_val));
diff --git a/tests/utests/types/int8.c b/tests/utests/types/int8.c
index 01f449e..0154d4f 100644
--- a/tests/utests/types/int8.c
+++ b/tests/utests/types/int8.c
@@ -1393,7 +1393,6 @@
lysc_type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
/* check proper type */
- assert_int_equal(LY_TYPE_INT8, type->type);
assert_string_equal("libyang 2 - integers, version 1", type->id);
/* check store
@@ -1560,7 +1559,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_INT8);
assert_int_equal(LY_SUCCESS, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
@@ -1573,7 +1571,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_INT8);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
@@ -1586,7 +1583,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_UINT8);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
diff --git a/tests/utests/types/string.c b/tests/utests/types/string.c
index 9aee86b..8007744 100644
--- a/tests/utests/types/string.c
+++ b/tests/utests/types/string.c
@@ -1054,7 +1054,6 @@
lysc_type = ((struct lysc_node_leaf *) mod->compiled->data)->type;
/* check proper type */
- assert_int_equal(LY_TYPE_STRING, type->type);
assert_string_equal("libyang 2 - string, version 1", type->id);
/* check store */
@@ -1192,7 +1191,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_STRING);
assert_int_equal(LY_SUCCESS, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
@@ -1203,7 +1201,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_STRING);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));
@@ -1214,7 +1211,6 @@
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
- assert_int_equal(diff_type->plugin->type, LY_TYPE_UINT8);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
type->free(UTEST_LYCTX, &(diff_type_val));