schema compile BUGFIXES test refine in uses and fix found issues
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index f87b3bf..b2e1a59 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -119,10 +119,10 @@
"Invalid descendant-schema-nodeid value \"%.*s\" - target node not found.", id - nodeid, nodeid);
return LY_ENOTFOUND;
}
- if (nodeid_len && ((size_t)(id - nodeid) >= nodeid_len)) {
+ if (!*id || (nodeid_len && ((size_t)(id - nodeid) >= nodeid_len))) {
break;
}
- if (id && *id != '/') {
+ if (*id != '/') {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Invalid descendant-schema-nodeid value \"%.*s\" - missing \"/\" as node-identifier separator.",
id - nodeid + 1, nodeid);
@@ -828,7 +828,7 @@
return LY_SUCCESS;
}
-#define FIND_MODULE(TYPE, MOD, ID) \
+#define FIND_MODULE(TYPE, MOD) \
TYPE *imp; \
if (!strncmp((MOD)->prefix, prefix, len) && (MOD)->prefix[len] == '\0') { \
/* it is the prefix of the module itself */ \
@@ -837,7 +837,7 @@
/* search in imports */ \
if (!m) { \
LY_ARRAY_FOR((MOD)->imports, TYPE, imp) { \
- if (!strncmp(imp->prefix, prefix, len) && (MOD)->prefix[len] == '\0') { \
+ if (!strncmp(imp->prefix, prefix, len) && imp->prefix[len] == '\0') { \
m = imp->module; \
break; \
} \
@@ -849,7 +849,7 @@
{
const struct lys_module *m = NULL;
- FIND_MODULE(struct lysc_import, mod, 1);
+ FIND_MODULE(struct lysc_import, mod);
return m ? m->compiled : NULL;
}
@@ -858,7 +858,7 @@
{
const struct lys_module *m = NULL;
- FIND_MODULE(struct lysp_import, mod, 1);
+ FIND_MODULE(struct lysp_import, mod);
return m ? m->parsed : NULL;
}
@@ -868,9 +868,9 @@
const struct lys_module *m = NULL;
if (mod->compiled) {
- FIND_MODULE(struct lysc_import, mod->compiled, 1);
+ FIND_MODULE(struct lysc_import, mod->compiled);
} else {
- FIND_MODULE(struct lysp_import, mod->parsed, 2);
+ FIND_MODULE(struct lysp_import, mod->parsed);
}
return (struct lys_module*)m;
}
@@ -1103,6 +1103,8 @@
} else {
return NULL;
}
+ case LYS_CASE:
+ return &((struct lysc_node_case*)node)->child;
case LYS_LIST:
return &((struct lysc_node_list*)node)->child;
/* TODO