xpath CHANGE make functions return LY_ERR values

some of the functions were mixing return value of -1 for error with
positive numbers for index in some set/array. Instead, make them return
LY_ERR value to clearly state the error type and return index via an
optional output parameter. This also avoids limiting unsigned index type
by the signed int type returned so far.
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 8ebf744..b302f39 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -6810,8 +6810,8 @@
                     /* skip roots'n'stuff */
                     if (tmp_set.val.scnodes[j].type == LYXP_NODE_ELEM) {
                         /* try to find this node in our set */
-                        int idx = lyxp_set_scnode_dup_node_check(set, tmp_set.val.scnodes[j].scnode, LYXP_NODE_ELEM, -1);
-                        if ((idx > -1) && (set->val.scnodes[idx].in_ctx == -1)) {
+                        uint32_t idx;
+                        if (lyxp_set_scnode_contains(set, tmp_set.val.scnodes[j].scnode, LYXP_NODE_ELEM, -1, &idx) && (set->val.scnodes[idx].in_ctx == -1)) {
                             LOGVAL(set->ctx, LY_VLOG_LYSC, node, LY_VCODE_CIRC_WHEN, node->name, set->val.scnodes[idx].scnode->name);
                             ret = LY_EVALID;
                             goto cleanup;