set CHANGE make ly_set* functions return LY_ERR values
unify ly_set* function that were returning -1 as error indicator
combined with positive value indicating index inside the set. The most
of other libyang functions return LY_ERR to indicate result. The problem
of these functions was also the limited range of the returned index.
While internally index is uint32_t, it was limited only to a positive
part of int type.
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 491b21c..496e9ff 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -215,7 +215,8 @@
/* get all keys into a set (keys do not have if-features or anything) */
snode = NULL;
while ((snode = lys_getnext(snode, list, NULL, LYS_GETNEXT_NOSTATECHECK)) && (snode->flags & LYS_KEY)) {
- ly_set_add(&key_set, (void *)snode, LY_SET_OPT_USEASLIST);
+ ret = ly_set_add(&key_set, (void *)snode, LY_SET_OPT_USEASLIST, NULL);
+ LY_CHECK_GOTO(ret, cleanup);
}
while (xmlctx->status == LYXML_ELEMENT) {