schema compile REFACTOR code duplication
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index a060aa1..a988e02 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -278,11 +278,6 @@
/* compile when */
LY_CHECK_RET(lys_compile_when_(ctx, when_p, flags, ctx_node, new_when));
- if (!(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
- /* do not check "when" semantics in a grouping */
- LY_CHECK_RET(ly_set_add(&ctx->xpath, node, 0, NULL));
- }
-
/* remember the compiled when for sharing */
if (when_c) {
*when_c = *new_when;
@@ -291,11 +286,12 @@
/* use the previously compiled when */
++(*when_c)->refcount;
*new_when = *when_c;
+ }
- if (!(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
- /* in this case check "when" again for all children because of dummy node check */
- LY_CHECK_RET(ly_set_add(&ctx->xpath, node, 0, NULL));
- }
+ if (!(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ /* do not check "when" semantics in a grouping, but repeat the check for different node because
+ * of dummy node check */
+ LY_CHECK_RET(ly_set_add(&ctx->xpath, node, 0, NULL));
}
return LY_SUCCESS;