schema tree REFACTOR compile case like a general node

Change included - all choice data children are not linked
siblings anymore but standard children of their case.
Fixes #1157
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 3d2dcb9..1ec681a 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -112,9 +112,10 @@
             next = (struct lysc_node *)(&notifs[u + 1]);
         }
         goto repeat;
+    } else {
+        next = last->next;
     }
 
-    next = last->next;
 repeat:
     if (next && parent && parent->nodetype == LYS_CASE && next->parent != parent) {
         /* inside case (as an explicit parent, not when diving into it from choice),
@@ -147,8 +148,15 @@
     case LYS_ANYDATA:
     case LYS_LIST:
     case LYS_LEAFLIST:
-    case LYS_CASE:
         break;
+    case LYS_CASE:
+        if (options & LYS_GETNEXT_WITHCASE) {
+            break;
+        } else {
+            /* go into */
+            next = ((struct lysc_node_case *)next)->child;
+        }
+        goto repeat;
     case LYS_CONTAINER:
         if (!(((struct lysc_node_container *)next)->flags & LYS_PRESENCE) && (options & LYS_GETNEXT_INTONPCONT)) {
             if (((struct lysc_node_container *)next)->child) {
@@ -162,7 +170,7 @@
         break;
     case LYS_CHOICE:
         if (options & LYS_GETNEXT_WITHCHOICE) {
-            return next;
+            break;
         } else if ((options & LYS_GETNEXT_NOCHOICE) || !((struct lysc_node_choice *)next)->cases) {
             next = next->next;
         } else {