diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 763e72e..cae0cd0 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -299,7 +299,7 @@
  * @param[in] orig The pattern structure to duplicate.
  * @return The duplicated structure to use.
  */
-static struct lysc_pattern*
+static struct lysc_pattern *
 lysc_pattern_dup(struct lysc_pattern *orig)
 {
     ++orig->refcount;
@@ -316,7 +316,7 @@
  * @return New sized array as a copy of @p orig.
  * @return NULL in case of memory allocation error.
  */
-static struct lysc_pattern**
+static struct lysc_pattern **
 lysc_patterns_dup(struct ly_ctx *ctx, struct lysc_pattern **orig)
 {
     struct lysc_pattern **dup = NULL;
@@ -340,7 +340,7 @@
  * @return New compiled range structure as a copy of @p orig.
  * @return NULL in case of memory allocation error.
  */
-struct lysc_range*
+struct lysc_range *
 lysc_range_dup(struct ly_ctx *ctx, const struct lysc_range *orig)
 {
     struct lysc_range *dup;
@@ -556,7 +556,7 @@
     ext->parent = parent;
     ext->parent_type = parent_type;
 
-    lysc_update_path(ctx, ext->parent_type == LYEXT_PAR_NODE ? (struct lysc_node*)ext->parent : NULL, "{extension}");
+    lysc_update_path(ctx, ext->parent_type == LYEXT_PAR_NODE ? (struct lysc_node *)ext->parent : NULL, "{extension}");
 
     /* get module where the extension definition should be placed */
     for (u = strlen(ext_p->name); u && ext_p->name[u - 1] != ':'; --u) {}
@@ -664,7 +664,7 @@
 
     if (ext->def->plugin && ext->def->plugin->compile) {
         if (ext->argument) {
-            lysc_update_path(ctx, (struct lysc_node*)ext, ext->argument);
+            lysc_update_path(ctx, (struct lysc_node *)ext, ext->argument);
         }
         LY_CHECK_GOTO(ext->def->plugin->compile(ctx, ext_p, ext), cleanup);
         if (ext->argument) {
@@ -2223,7 +2223,7 @@
 /**
  * @brief stringification of the YANG built-in data types
  */
-const char* ly_data_type2str[LY_DATA_TYPE_COUNT] = {"unknown", "binary", "8bit unsigned integer", "16bit unsigned integer",
+const char *ly_data_type2str[LY_DATA_TYPE_COUNT] = {"unknown", "binary", "8bit unsigned integer", "16bit unsigned integer",
     "32bit unsigned integer", "64bit unsigned integer", "string", "bits", "boolean", "decimal64", "empty", "enumeration",
     "identityref", "instance-identifier", "leafref", "union", "8bit integer", "16bit integer", "32bit integer", "64bit integer"};
 
@@ -2542,12 +2542,12 @@
 
     switch (basetype) {
     case LY_TYPE_BINARY:
-        bin = (struct lysc_type_bin*)(*type);
+        bin = (struct lysc_type_bin *)(*type);
 
         /* RFC 7950 9.8.1, 9.4.4 - length, number of octets it contains */
         if (type_p->length) {
             LY_CHECK_RET(lys_compile_type_range(ctx, type_p->length, basetype, 1, 0,
-                                                base ? ((struct lysc_type_bin*)base)->length : NULL, &bin->length));
+                                                base ? ((struct lysc_type_bin *)base)->length : NULL, &bin->length));
             if (!tpdfname) {
                 COMPILE_EXTS_GOTO(ctx, type_p->length->exts, bin->length->exts, bin->length, LYEXT_PAR_LENGTH, ret, done);
             }
@@ -2560,11 +2560,11 @@
         break;
     case LY_TYPE_BITS:
         /* RFC 7950 9.7 - bits */
-        bits = (struct lysc_type_bits*)(*type);
+        bits = (struct lysc_type_bits *)(*type);
         if (type_p->bits) {
             LY_CHECK_RET(lys_compile_type_enums(ctx, type_p->bits, basetype,
-                                                base ? (struct lysc_type_bitenum_item*)((struct lysc_type_bits*)base)->bits : NULL,
-                    (struct lysc_type_bitenum_item**)&bits->bits));
+                                                base ? (struct lysc_type_bitenum_item *)((struct lysc_type_bits *)base)->bits : NULL,
+                    (struct lysc_type_bitenum_item **)&bits->bits));
         }
 
         if (!base && !type_p->flags) {
@@ -2633,25 +2633,25 @@
         }
         break;
     case LY_TYPE_STRING:
-        str = (struct lysc_type_str*)(*type);
+        str = (struct lysc_type_str *)(*type);
 
         /* RFC 7950 9.4.4 - length */
         if (type_p->length) {
             LY_CHECK_RET(lys_compile_type_range(ctx, type_p->length, basetype, 1, 0,
-                                                base ? ((struct lysc_type_str*)base)->length : NULL, &str->length));
+                                                base ? ((struct lysc_type_str *)base)->length : NULL, &str->length));
             if (!tpdfname) {
                 COMPILE_EXTS_GOTO(ctx, type_p->length->exts, str->length->exts, str->length, LYEXT_PAR_LENGTH, ret, done);
             }
-        } else if (base && ((struct lysc_type_str*)base)->length) {
-            str->length = lysc_range_dup(ctx->ctx, ((struct lysc_type_str*)base)->length);
+        } else if (base && ((struct lysc_type_str *)base)->length) {
+            str->length = lysc_range_dup(ctx->ctx, ((struct lysc_type_str *)base)->length);
         }
 
         /* RFC 7950 9.4.5 - pattern */
         if (type_p->patterns) {
             LY_CHECK_RET(lys_compile_type_patterns(ctx, type_p->patterns,
-                                                   base ? ((struct lysc_type_str*)base)->patterns : NULL, &str->patterns));
-        } else if (base && ((struct lysc_type_str*)base)->patterns) {
-            str->patterns = lysc_patterns_dup(ctx->ctx, ((struct lysc_type_str*)base)->patterns);
+                                                   base ? ((struct lysc_type_str *)base)->patterns : NULL, &str->patterns));
+        } else if (base && ((struct lysc_type_str *)base)->patterns) {
+            str->patterns = lysc_patterns_dup(ctx->ctx, ((struct lysc_type_str *)base)->patterns);
         }
 
         if (tpdfname) {
@@ -2660,12 +2660,12 @@
         }
         break;
     case LY_TYPE_ENUM:
-        enumeration = (struct lysc_type_enum*)(*type);
+        enumeration = (struct lysc_type_enum *)(*type);
 
         /* RFC 7950 9.6 - enum */
         if (type_p->enums) {
             LY_CHECK_RET(lys_compile_type_enums(ctx, type_p->enums, basetype,
-                                                base ? ((struct lysc_type_enum*)base)->enums : NULL, &enumeration->enums));
+                                                base ? ((struct lysc_type_enum *)base)->enums : NULL, &enumeration->enums));
         }
 
         if (!base && !type_p->flags) {
@@ -2693,12 +2693,12 @@
     case LY_TYPE_UINT32:
     case LY_TYPE_INT64:
     case LY_TYPE_UINT64:
-        num = (struct lysc_type_num*)(*type);
+        num = (struct lysc_type_num *)(*type);
 
         /* RFC 6020 9.2.4 - range */
         if (type_p->range) {
             LY_CHECK_RET(lys_compile_type_range(ctx, type_p->range, basetype, 0, 0,
-                                                base ? ((struct lysc_type_num*)base)->range : NULL, &num->range));
+                                                base ? ((struct lysc_type_num *)base)->range : NULL, &num->range));
             if (!tpdfname) {
                 COMPILE_EXTS_GOTO(ctx, type_p->range->exts, num->range->exts, num->range, LYEXT_PAR_RANGE, ret, done);
             }
@@ -2710,7 +2710,7 @@
         }
         break;
     case LY_TYPE_IDENT:
-        idref = (struct lysc_type_identityref*)(*type);
+        idref = (struct lysc_type_identityref *)(*type);
 
         /* RFC 7950 9.10.2 - base */
         if (type_p->bases) {
@@ -2749,7 +2749,7 @@
         }
         break;
     case LY_TYPE_LEAFREF:
-        lref = (struct lysc_type_leafref*)*type;
+        lref = (struct lysc_type_leafref *)*type;
 
         /* RFC 7950 9.9.3 - require-instance */
         if (type_p->flags & LYS_SET_REQINST) {
@@ -2777,8 +2777,8 @@
             lref->path = lyxp_expr_dup(ctx->ctx, type_p->path);
             lref->path_context = module;
         } else if (base) {
-            lref->path = lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref*)base)->path);
-            lref->path_context = ((struct lysc_type_leafref*)base)->path_context;
+            lref->path = lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref *)base)->path);
+            lref->path_context = ((struct lysc_type_leafref *)base)->path_context;
         } else if (tpdfname) {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_MISSCHILDSTMT, "path", "leafref type ", tpdfname);
             return LY_EVALID;
@@ -2796,10 +2796,10 @@
     case LY_TYPE_INST:
         /* RFC 7950 9.9.3 - require-instance */
         if (type_p->flags & LYS_SET_REQINST) {
-            ((struct lysc_type_instanceid*)(*type))->require_instance = type_p->require_instance;
+            ((struct lysc_type_instanceid *)(*type))->require_instance = type_p->require_instance;
         } else {
             /* default is true */
-            ((struct lysc_type_instanceid*)(*type))->require_instance = 1;
+            ((struct lysc_type_instanceid *)(*type))->require_instance = 1;
         }
 
         if (tpdfname) {
@@ -2808,7 +2808,7 @@
         }
         break;
     case LY_TYPE_UNION:
-        un = (struct lysc_type_union*)(*type);
+        un = (struct lysc_type_union *)(*type);
 
         /* RFC 7950 7.4 - type */
         if (type_p->types) {
@@ -2834,22 +2834,22 @@
                 if (un->types[u + additional]->basetype == LY_TYPE_UNION) {
                     /* add space for additional types from the union subtype */
                     un_aux = (struct lysc_type_union *)un->types[u + additional];
-                    LY_ARRAY_RESIZE_ERR_RET(ctx->ctx, un->types, (*((uint64_t*)(type_p->types) - 1)) + additional + LY_ARRAY_COUNT(un_aux->types) - 1,
-                                            lysc_type_free(ctx->ctx, (struct lysc_type*)un_aux), LY_EMEM);
+                    LY_ARRAY_RESIZE_ERR_RET(ctx->ctx, un->types, (*((uint64_t *)(type_p->types) - 1)) + additional + LY_ARRAY_COUNT(un_aux->types) - 1,
+                                            lysc_type_free(ctx->ctx, (struct lysc_type *)un_aux), LY_EMEM);
 
                     /* copy subtypes of the subtype union */
                     for (LY_ARRAY_COUNT_TYPE v = 0; v < LY_ARRAY_COUNT(un_aux->types); ++v) {
                         if (un_aux->types[v]->basetype == LY_TYPE_LEAFREF) {
                             /* duplicate the whole structure because of the instance-specific path resolving for realtype */
                             un->types[u + additional] = calloc(1, sizeof(struct lysc_type_leafref));
-                            LY_CHECK_ERR_RET(!un->types[u + additional], LOGMEM(ctx->ctx); lysc_type_free(ctx->ctx, (struct lysc_type*)un_aux), LY_EMEM);
+                            LY_CHECK_ERR_RET(!un->types[u + additional], LOGMEM(ctx->ctx); lysc_type_free(ctx->ctx, (struct lysc_type *)un_aux), LY_EMEM);
                             lref = (struct lysc_type_leafref *)un->types[u + additional];
 
                             lref->basetype = LY_TYPE_LEAFREF;
-                            lref->path = lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref*)un_aux->types[v])->path);
+                            lref->path = lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref *)un_aux->types[v])->path);
                             lref->refcount = 1;
-                            lref->require_instance = ((struct lysc_type_leafref*)un_aux->types[v])->require_instance;
-                            lref->path_context = ((struct lysc_type_leafref*)un_aux->types[v])->path_context;
+                            lref->require_instance = ((struct lysc_type_leafref *)un_aux->types[v])->require_instance;
+                            lref->path_context = ((struct lysc_type_leafref *)un_aux->types[v])->path_context;
                             /* TODO extensions */
 
                         } else {
@@ -2863,7 +2863,7 @@
                     --additional;
 
                     /* free the replaced union subtype */
-                    lysc_type_free(ctx->ctx, (struct lysc_type*)un_aux);
+                    lysc_type_free(ctx->ctx, (struct lysc_type *)un_aux);
                 } else {
                     LY_ARRAY_INCREMENT(un->types);
                 }
@@ -2962,7 +2962,7 @@
             *dflt_mod = tctx->mod->mod;
         }
         if (dummyloops && (!units || *units) && dflt && *dflt) {
-            basetype = ((struct type_context*)tpdf_chain.objs[tpdf_chain.count - 1])->tpdf->type.compiled->basetype;
+            basetype = ((struct type_context *)tpdf_chain.objs[tpdf_chain.count - 1])->tpdf->type.compiled->basetype;
             break;
         }
 
@@ -2983,7 +2983,7 @@
         /* circular typedef reference detection */
         for (u = 0; u < tpdf_chain.count; u++) {
             /* local part */
-            tctx_iter = (struct type_context*)tpdf_chain.objs[u];
+            tctx_iter = (struct type_context *)tpdf_chain.objs[u];
             if (tctx_iter->mod == tctx->mod && tctx_iter->node == tctx->node && tctx_iter->tpdf == tctx->tpdf) {
                 LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                        "Invalid \"%s\" type reference - circular chain of types detected.", tctx->tpdf->name);
@@ -2994,7 +2994,7 @@
         }
         for (u = 0; u < ctx->tpdf_chain.count; u++) {
             /* global part for unions corner case */
-            tctx_iter = (struct type_context*)ctx->tpdf_chain.objs[u];
+            tctx_iter = (struct type_context *)ctx->tpdf_chain.objs[u];
             if (tctx_iter->mod == tctx->mod && tctx_iter->node == tctx->node && tctx_iter->tpdf == tctx->tpdf) {
                 LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                        "Invalid \"%s\" type reference - circular chain of types detected.", tctx->tpdf->name);
@@ -3076,7 +3076,7 @@
 
     /* get restrictions from the referred typedefs */
     for (u = tpdf_chain.count - 1; u + 1 > 0; --u) {
-        tctx = (struct type_context*)tpdf_chain.objs[u];
+        tctx = (struct type_context *)tpdf_chain.objs[u];
 
         /* remember the typedef context for circular check */
         ly_set_add(&ctx->tpdf_chain, tctx, LY_SET_OPT_USEASLIST);
@@ -3086,7 +3086,7 @@
             continue;
         } else if (basetype != LY_TYPE_LEAFREF && (u != tpdf_chain.count - 1) && !(tctx->tpdf->type.flags)) {
             /* no change, just use the type information from the base */
-            base = ((struct lysp_tpdf*)tctx->tpdf)->type.compiled = ((struct type_context*)tpdf_chain.objs[u + 1])->tpdf->type.compiled;
+            base = ((struct lysp_tpdf *)tctx->tpdf)->type.compiled = ((struct type_context *)tpdf_chain.objs[u + 1])->tpdf->type.compiled;
             ++base->refcount;
             continue;
         }
@@ -3109,7 +3109,7 @@
         /* TODO user type plugins */
         (*type)->plugin = &ly_builtin_type_plugins[basetype];
         prev_type = *type;
-        ret = lys_compile_type_(ctx, tctx->node, tctx->tpdf->flags, tctx->mod, tctx->tpdf->name, &((struct lysp_tpdf*)tctx->tpdf)->type,
+        ret = lys_compile_type_(ctx, tctx->node, tctx->tpdf->flags, tctx->mod, tctx->tpdf->name, &((struct lysp_tpdf *)tctx->tpdf)->type,
                                 basetype & (LY_TYPE_LEAFREF | LY_TYPE_UNION) ? lysp_find_module(ctx->ctx, tctx->mod) : NULL,
                                 basetype, tctx->tpdf->name, base, type);
         LY_CHECK_GOTO(ret, cleanup);
@@ -3287,23 +3287,23 @@
     COMPILE_EXTS_GOTO(ctx, action_p->exts, action->exts, action, LYEXT_PAR_NODE, ret, cleanup);
 
     /* input */
-    lysc_update_path(ctx, (struct lysc_node*)action, "input");
+    lysc_update_path(ctx, (struct lysc_node *)action, "input");
     COMPILE_ARRAY_GOTO(ctx, action_p->input.musts, action->input.musts, u, lys_compile_must, ret, cleanup);
     COMPILE_EXTS_GOTO(ctx, action_p->input.exts, action->input_exts, &action->input, LYEXT_PAR_INPUT, ret, cleanup);
     ctx->options |= LYSC_OPT_RPC_INPUT;
     LY_LIST_FOR(action_p->input.data, child_p) {
-        LY_CHECK_RET(lys_compile_node(ctx, child_p, (struct lysc_node*)action, uses_status));
+        LY_CHECK_RET(lys_compile_node(ctx, child_p, (struct lysc_node *)action, uses_status));
     }
     lysc_update_path(ctx, NULL, NULL);
     ctx->options = opt_prev;
 
     /* output */
-    lysc_update_path(ctx, (struct lysc_node*)action, "output");
+    lysc_update_path(ctx, (struct lysc_node *)action, "output");
     COMPILE_ARRAY_GOTO(ctx, action_p->output.musts, action->output.musts, u, lys_compile_must, ret, cleanup);
     COMPILE_EXTS_GOTO(ctx, action_p->output.exts, action->output_exts, &action->output, LYEXT_PAR_OUTPUT, ret, cleanup);
     ctx->options |= LYSC_OPT_RPC_OUTPUT;
     LY_LIST_FOR(action_p->output.data, child_p) {
-        LY_CHECK_RET(lys_compile_node(ctx, child_p, (struct lysc_node*)action, uses_status));
+        LY_CHECK_RET(lys_compile_node(ctx, child_p, (struct lysc_node *)action, uses_status));
     }
     lysc_update_path(ctx, NULL, NULL);
     lysc_update_path(ctx, NULL, NULL);
@@ -3378,7 +3378,7 @@
 
     ctx->options |= LYSC_OPT_NOTIFICATION;
     LY_LIST_FOR(notif_p->data, child_p) {
-        LY_CHECK_RET(lys_compile_node(ctx, child_p, (struct lysc_node*)notif, uses_status));
+        LY_CHECK_RET(lys_compile_node(ctx, child_p, (struct lysc_node *)notif, uses_status));
     }
 
     lysc_update_path(ctx, NULL, NULL);
@@ -3398,8 +3398,8 @@
 static LY_ERR
 lys_compile_node_container(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node *node)
 {
-    struct lysp_node_container *cont_p = (struct lysp_node_container*)node_p;
-    struct lysc_node_container *cont = (struct lysc_node_container*)node;
+    struct lysp_node_container *cont_p = (struct lysp_node_container *)node_p;
+    struct lysc_node_container *cont = (struct lysc_node_container *)node;
     struct lysp_node *child_p;
     LY_ARRAY_COUNT_TYPE u;
     LY_ERR ret = LY_SUCCESS;
@@ -3507,8 +3507,8 @@
 static LY_ERR
 lys_compile_node_leaf(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node *node)
 {
-    struct lysp_node_leaf *leaf_p = (struct lysp_node_leaf*)node_p;
-    struct lysc_node_leaf *leaf = (struct lysc_node_leaf*)node;
+    struct lysp_node_leaf *leaf_p = (struct lysp_node_leaf *)node_p;
+    struct lysc_node_leaf *leaf = (struct lysc_node_leaf *)node;
     LY_ARRAY_COUNT_TYPE u;
     LY_ERR ret = LY_SUCCESS;
 
@@ -3546,8 +3546,8 @@
 static LY_ERR
 lys_compile_node_leaflist(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node *node)
 {
-    struct lysp_node_leaflist *llist_p = (struct lysp_node_leaflist*)node_p;
-    struct lysc_node_leaflist *llist = (struct lysc_node_leaflist*)node;
+    struct lysp_node_leaflist *llist_p = (struct lysp_node_leaflist *)node_p;
+    struct lysc_node_leaflist *llist = (struct lysc_node_leaflist *)node;
     LY_ARRAY_COUNT_TYPE u;
     LY_ERR ret = LY_SUCCESS;
 
@@ -3617,8 +3617,8 @@
 
             /* unique node must be present */
             LY_ARRAY_NEW_RET(ctx->ctx, *unique, key, LY_EMEM);
-            ret = lysc_resolve_schema_nodeid(ctx, keystr, len, (struct lysc_node*)list, context_module, LYS_LEAF, 0,
-                            (const struct lysc_node**)key, &flags);
+            ret = lysc_resolve_schema_nodeid(ctx, keystr, len, (struct lysc_node *)list, context_module, LYS_LEAF, 0,
+                            (const struct lysc_node **)key, &flags);
             if (ret != LY_SUCCESS) {
                 if (ret == LY_EDENIED) {
                     LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
@@ -3680,8 +3680,8 @@
 static LY_ERR
 lys_compile_node_list(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node *node)
 {
-    struct lysp_node_list *list_p = (struct lysp_node_list*)node_p;
-    struct lysc_node_list *list = (struct lysc_node_list*)node;
+    struct lysp_node_list *list_p = (struct lysp_node_list *)node_p;
+    struct lysc_node_list *list = (struct lysc_node_list *)node;
     struct lysp_node *child_p;
     struct lysc_node_leaf *key, *prev_key = NULL;
     size_t len;
@@ -3729,7 +3729,7 @@
         }
 
         /* key node must be present */
-        key = (struct lysc_node_leaf*)lys_find_child(node, node->module, keystr, len, LYS_LEAF, LYS_GETNEXT_NOCHOICE | LYS_GETNEXT_NOSTATECHECK);
+        key = (struct lysc_node_leaf *)lys_find_child(node, node->module, keystr, len, LYS_LEAF, LYS_GETNEXT_NOCHOICE | LYS_GETNEXT_NOSTATECHECK);
         if (!(key)) {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                    "The list's key \"%.*s\" not found.", len, keystr);
@@ -3743,7 +3743,7 @@
             return LY_EVALID;
         }
 
-        lysc_update_path(ctx, (struct lysc_node*)list, key->name);
+        lysc_update_path(ctx, (struct lysc_node *)list, key->name);
         /* key must have the same config flag as the list itself */
         if ((list->flags & LYS_CONFIG_MASK) != (key->flags & LYS_CONFIG_MASK)) {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS, "Key of the configuration list must not be status leaf.");
@@ -3785,7 +3785,7 @@
         key->flags |= LYS_KEY;
 
         /* move it to the correct position */
-        if ((prev_key && (struct lysc_node*)prev_key != key->prev) || (!prev_key && key->prev->next)) {
+        if ((prev_key && (struct lysc_node *)prev_key != key->prev) || (!prev_key && key->prev->next)) {
             /* fix links in closest previous siblings of the key */
             if (key->next) {
                 key->next->prev = key->prev;
@@ -3798,7 +3798,7 @@
             }
             /* fix links in the key */
             if (prev_key) {
-                key->prev = (struct lysc_node*)prev_key;
+                key->prev = (struct lysc_node *)prev_key;
                 key->next = prev_key->next;
             } else {
                 key->prev = list->child->prev;
@@ -3807,17 +3807,17 @@
             /* fix links in closes future siblings of the key */
             if (prev_key) {
                 if (prev_key->next) {
-                    prev_key->next->prev = (struct lysc_node*)key;
+                    prev_key->next->prev = (struct lysc_node *)key;
                 } else {
-                    list->child->prev = (struct lysc_node*)key;
+                    list->child->prev = (struct lysc_node *)key;
                 }
-                prev_key->next = (struct lysc_node*)key;
+                prev_key->next = (struct lysc_node *)key;
             } else {
-                list->child->prev = (struct lysc_node*)key;
+                list->child->prev = (struct lysc_node *)key;
             }
             /* fix links in parent */
             if (!key->prev->next) {
-                list->child = (struct lysc_node*)key;
+                list->child = (struct lysc_node *)key;
             }
         }
 
@@ -3853,7 +3853,7 @@
 static LY_ERR
 lys_compile_node_choice_dflt(struct lysc_ctx *ctx, const char *dflt, struct lysc_node_choice *ch)
 {
-    struct lysc_node *iter, *node = (struct lysc_node*)ch;
+    struct lysc_node *iter, *node = (struct lysc_node *)ch;
     const char *prefix = NULL, *name;
     size_t prefix_len = 0;
 
@@ -3873,7 +3873,7 @@
                prefix_len, prefix);
         return LY_EVALID;
     }
-    ch->dflt = (struct lysc_node_case*)lys_find_child(node, node->module, name, 0, LYS_CASE, LYS_GETNEXT_NOSTATECHECK | LYS_GETNEXT_WITHCASE);
+    ch->dflt = (struct lysc_node_case *)lys_find_child(node, node->module, name, 0, LYS_CASE, LYS_GETNEXT_NOSTATECHECK | LYS_GETNEXT_WITHCASE);
     if (!ch->dflt) {
         LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS,
                "Default case \"%s\" not found.", dflt);
@@ -3881,7 +3881,7 @@
     }
     /* no mandatory nodes directly under the default case */
     LY_LIST_FOR(ch->dflt->child, iter) {
-        if (iter->parent != (struct lysc_node*)ch->dflt) {
+        if (iter->parent != (struct lysc_node *)ch->dflt) {
             break;
         }
         if (iter->flags & LYS_MAND_TRUE) {
@@ -3924,7 +3924,7 @@
         mod = ctx->mod;
     }
     /* get the default case */
-    cs = (struct lysc_node_case*)lys_find_child((struct lysc_node*)ch, mod, name, 0, LYS_CASE, LYS_GETNEXT_NOSTATECHECK | LYS_GETNEXT_WITHCASE);
+    cs = (struct lysc_node_case *)lys_find_child((struct lysc_node *)ch, mod, name, 0, LYS_CASE, LYS_GETNEXT_NOSTATECHECK | LYS_GETNEXT_WITHCASE);
     if (!cs) {
         LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                "Invalid deviation adding \"default\" property \"%s\" of choice - the specified case does not exists.", dflt);
@@ -3933,7 +3933,7 @@
 
     /* check that there is no mandatory node */
     LY_LIST_FOR(cs->child, node) {
-        if (node->parent != (struct lysc_node*)cs) {
+        if (node->parent != (struct lysc_node *)cs) {
             break;
         }
         if (node->flags & LYS_MAND_TRUE) {
@@ -3962,14 +3962,14 @@
 static LY_ERR
 lys_compile_node_choice(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node *node)
 {
-    struct lysp_node_choice *ch_p = (struct lysp_node_choice*)node_p;
-    struct lysc_node_choice *ch = (struct lysc_node_choice*)node;
+    struct lysp_node_choice *ch_p = (struct lysp_node_choice *)node_p;
+    struct lysc_node_choice *ch = (struct lysc_node_choice *)node;
     struct lysp_node *child_p, *case_child_p;
     LY_ERR ret = LY_SUCCESS;
 
     LY_LIST_FOR(ch_p->child, child_p) {
         if (child_p->nodetype == LYS_CASE) {
-            LY_LIST_FOR(((struct lysp_node_case*)child_p)->child, case_child_p) {
+            LY_LIST_FOR(((struct lysp_node_case *)child_p)->child, case_child_p) {
                 LY_CHECK_RET(lys_compile_node(ctx, case_child_p, node, 0));
             }
         } else {
@@ -3996,8 +3996,8 @@
 static LY_ERR
 lys_compile_node_any(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node *node)
 {
-    struct lysp_node_anydata *any_p = (struct lysp_node_anydata*)node_p;
-    struct lysc_node_anydata *any = (struct lysc_node_anydata*)node;
+    struct lysp_node_anydata *any_p = (struct lysp_node_anydata *)node_p;
+    struct lysc_node_anydata *any = (struct lysc_node_anydata *)node;
     unsigned int u;
     LY_ERR ret = LY_SUCCESS;
 
@@ -4033,7 +4033,7 @@
     const struct lys_module *mod;
 
     if (node->nodetype == LYS_CASE) {
-        children = (struct lysc_node**)&((struct lysc_node_choice*)parent)->cases;
+        children = (struct lysc_node **)&((struct lysc_node_choice *)parent)->cases;
     } else {
         children = lysc_node_children_p(parent, ctx->options);
     }
@@ -4097,7 +4097,7 @@
  * @return The case structure where the child node belongs to, NULL in case of error. Note that the child is not connected into the siblings list,
  * it is linked from the case structure only in case it is its first child.
  */
-static struct lysc_node_case*
+static struct lysc_node_case *
 lys_compile_node_case(struct lysc_ctx *ctx, struct lysp_node *node_p, struct lysc_node_choice *ch, struct lysc_node *child)
 {
     struct lysc_node *iter;
@@ -4120,19 +4120,19 @@
         /* we have to add an implicit case node into the parent choice */
         cs = calloc(1, sizeof(struct lysc_node_case));
         DUP_STRING(ctx->ctx, child->name, cs->name);
-        cs->parent = (struct lysc_node*)ch;
+        cs->parent = (struct lysc_node *)ch;
         cs->flags = ch->flags & LYS_STATUS_MASK;
     } else if (node_p->nodetype == LYS_CASE) {
         if (ch->cases && (node_p == ch->cases->prev->sp)) {
             /* the case is already present since the child is not its first children */
-            return (struct lysc_node_case*)ch->cases->prev;
+            return (struct lysc_node_case *)ch->cases->prev;
         }
         UNIQUE_CHECK(node_p->name, ctx->mod);
 
         /* explicit parent case is not present (this is its first child) */
         cs = calloc(1, sizeof(struct lysc_node_case));
         DUP_STRING(ctx->ctx, node_p->name, cs->name);
-        cs->parent = (struct lysc_node*)ch;
+        cs->parent = (struct lysc_node *)ch;
         cs->flags = LYS_STATUS_MASK & node_p->flags;
         cs->sp = node_p;
 
@@ -4155,15 +4155,15 @@
         goto error;
     }
     cs->module = ctx->mod;
-    cs->prev = (struct lysc_node*)cs;
+    cs->prev = (struct lysc_node *)cs;
     cs->nodetype = LYS_CASE;
-    lys_compile_node_connect(ctx, (struct lysc_node*)ch, (struct lysc_node*)cs);
+    lys_compile_node_connect(ctx, (struct lysc_node *)ch, (struct lysc_node *)cs);
     cs->child = child;
 
     return cs;
 error:
     if (cs) {
-        lysc_node_free(ctx->ctx, (struct lysc_node*)cs);
+        lysc_node_free(ctx->ctx, (struct lysc_node *)cs);
     }
     return NULL;
 
@@ -4221,7 +4221,7 @@
     node->flags |= config;
 
     /* inherit the change into the children */
-    LY_LIST_FOR((struct lysc_node*)lysc_node_children(node, 0), child) {
+    LY_LIST_FOR((struct lysc_node *)lysc_node_children(node, 0), child) {
         LY_CHECK_RET(lys_compile_change_config(ctx, child, config_flag, 1, refine_flag));
     }
 
@@ -4250,7 +4250,7 @@
         }
     } else { /* unset flag */
         for ( ; parent && parent->nodetype == LYS_CONTAINER && (parent->flags & LYS_MAND_TRUE); parent = parent->parent) {
-            for (iter = (struct lysc_node*)lysc_node_children(parent, 0); iter; iter = iter->next) {
+            for (iter = (struct lysc_node *)lysc_node_children(parent, 0); iter; iter = iter->next) {
                 if (iter->flags & LYS_MAND_TRUE) {
                     /* there is another mandatory node */
                     return;
@@ -4374,7 +4374,7 @@
 
     ret = lysc_resolve_schema_nodeid(ctx, aug_p->nodeid, 0, parent, parent ? parent->module : ctx->mod_def,
                                                LYS_CONTAINER | LYS_LIST | LYS_CHOICE | LYS_CASE | LYS_INOUT | LYS_NOTIF,
-                                               1, (const struct lysc_node**)&target, &flags);
+                                               1, (const struct lysc_node **)&target, &flags);
     if (ret != LY_SUCCESS) {
         if (ret == LY_EDENIED) {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
@@ -4420,13 +4420,13 @@
          * here we gets the last created node as last children of our parent */
         if (target->nodetype == LYS_CASE) {
             /* the compiled node is the last child of the target (but it is a case, so we have to be careful and stop) */
-            for (node = (struct lysc_node*)lysc_node_children(target, flags); node->next && node->next->parent == node->parent; node = node->next) {}
+            for (node = (struct lysc_node *)lysc_node_children(target, flags); node->next && node->next->parent == node->parent; node = node->next) {}
         } else if (target->nodetype == LYS_CHOICE) {
             /* to pass when statement, we need the last case no matter if it is explicit or implicit case */
-            node = ((struct lysc_node_choice*)target)->cases->prev;
+            node = ((struct lysc_node_choice *)target)->cases->prev;
         } else {
             /* the compiled node is the last child of the target */
-            node = (struct lysc_node*)lysc_node_children(target, flags);
+            node = (struct lysc_node *)lysc_node_children(target, flags);
             if (!node) {
                 /* there is no data children (compiled nodes is e.g. notification or action or nothing) */
                 break;
@@ -4470,15 +4470,15 @@
     ctx->options |= flags;
     switch (target->nodetype) {
     case LYS_CONTAINER:
-        COMPILE_ARRAY1_GOTO(ctx, aug_p->actions, ((struct lysc_node_container*)target)->actions, target,
+        COMPILE_ARRAY1_GOTO(ctx, aug_p->actions, ((struct lysc_node_container *)target)->actions, target,
                             u, lys_compile_action, 0, ret, error);
-        COMPILE_ARRAY1_GOTO(ctx, aug_p->notifs, ((struct lysc_node_container*)target)->notifs, target,
+        COMPILE_ARRAY1_GOTO(ctx, aug_p->notifs, ((struct lysc_node_container *)target)->notifs, target,
                             u, lys_compile_notif, 0, ret, error);
         break;
     case LYS_LIST:
-        COMPILE_ARRAY1_GOTO(ctx, aug_p->actions, ((struct lysc_node_list*)target)->actions, target,
+        COMPILE_ARRAY1_GOTO(ctx, aug_p->actions, ((struct lysc_node_list *)target)->actions, target,
                             u, lys_compile_action, 0, ret, error);
-        COMPILE_ARRAY1_GOTO(ctx, aug_p->notifs, ((struct lysc_node_list*)target)->notifs, target,
+        COMPILE_ARRAY1_GOTO(ctx, aug_p->notifs, ((struct lysc_node_list *)target)->notifs, target,
                             u, lys_compile_notif, 0, ret, error);
         break;
     default:
@@ -4596,7 +4596,7 @@
         .module = ctx->mod,
         .flags = parent ? parent->flags : 0,
         .child = NULL, .next = NULL,
-        .prev = (struct lysc_node*)&context_node_fake,
+        .prev = (struct lysc_node *)&context_node_fake,
         .actions = NULL, .notifs = NULL};
     struct lysp_grp *grp = NULL;
     LY_ARRAY_COUNT_TYPE u, v;
@@ -4632,7 +4632,7 @@
     }
     if (mod == ctx->mod_def) {
         for (node_p = uses_p->parent; !found && node_p; node_p = node_p->parent) {
-            grp = (struct lysp_grp*)lysp_node_groupings(node_p);
+            grp = (struct lysp_grp *)lysp_node_groupings(node_p);
             LY_ARRAY_FOR(grp, u) {
                 if (!strcmp(grp[u].name, name)) {
                     grp = &grp[u];
@@ -4676,7 +4676,7 @@
 
     /* grouping must not reference themselves - stack in ctx maintains list of groupings currently being applied */
     grp_stack_count = ctx->groupings.count;
-    ly_set_add(&ctx->groupings, (void*)grp, 0);
+    ly_set_add(&ctx->groupings, (void *)grp, 0);
     if (grp_stack_count == ctx->groupings.count) {
         /* the target grouping is already in the stack, so we are already inside it -> circular dependency */
         LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
@@ -4699,9 +4699,9 @@
      * applu refine and augment only to the nodes from the uses */
     if (parent) {
         if (parent->nodetype == LYS_CASE) {
-            child = (struct lysc_node*)lysc_node_children(parent->parent, ctx->options & LYSC_OPT_RPC_MASK);
+            child = (struct lysc_node *)lysc_node_children(parent->parent, ctx->options & LYSC_OPT_RPC_MASK);
         } else {
-            child = (struct lysc_node*)lysc_node_children(parent, ctx->options & LYSC_OPT_RPC_MASK);
+            child = (struct lysc_node *)lysc_node_children(parent, ctx->options & LYSC_OPT_RPC_MASK);
         }
     } else if (ctx->mod->compiled->data) {
         child = ctx->mod->compiled->data;
@@ -4723,7 +4723,7 @@
     if (child) {
         context_node_fake.child = child->next;
     } else if (parent) {
-        context_node_fake.child = (struct lysc_node*)lysc_node_children(parent, ctx->options & LYSC_OPT_RPC_MASK);
+        context_node_fake.child = (struct lysc_node *)lysc_node_children(parent, ctx->options & LYSC_OPT_RPC_MASK);
     } else if (ctx->mod->compiled->data) {
         context_node_fake.child = ctx->mod->compiled->data;
     }
@@ -4735,7 +4735,7 @@
 
     when_shared = NULL;
     LY_LIST_FOR(context_node_fake.child, iter) {
-        iter->parent = (struct lysc_node*)&context_node_fake;
+        iter->parent = (struct lysc_node *)&context_node_fake;
 
         /* pass uses's when to all the data children, actions and notifications are ignored */
         if (uses_p->when) {
@@ -4790,7 +4790,7 @@
     /* sort and apply augments */
     LY_CHECK_GOTO(lys_compile_augment_sort(ctx, uses_p->augments, NULL, &augments), cleanup);
     LY_ARRAY_FOR(augments, u) {
-        LY_CHECK_GOTO(lys_compile_augment(ctx, augments[u], (struct lysc_node*)&context_node_fake), cleanup);
+        LY_CHECK_GOTO(lys_compile_augment(ctx, augments[u], (struct lysc_node *)&context_node_fake), cleanup);
     }
 
     /* reload previous context's mod_def */
@@ -4801,8 +4801,8 @@
     LY_ARRAY_FOR(uses_p->refines, struct lysp_refine, rfn) {
         lysc_update_path(ctx, NULL, rfn->nodeid);
 
-        LY_CHECK_GOTO(lysc_resolve_schema_nodeid(ctx, rfn->nodeid, 0, (struct lysc_node*)&context_node_fake, ctx->mod,
-                                                0, 0, (const struct lysc_node**)&node, &flags),
+        LY_CHECK_GOTO(lysc_resolve_schema_nodeid(ctx, rfn->nodeid, 0, (struct lysc_node *)&context_node_fake, ctx->mod,
+                                                0, 0, (const struct lysc_node **)&node, &flags),
                       cleanup);
         ly_set_add(&refined, node, LY_SET_OPT_USEASLIST);
 
@@ -4837,11 +4837,11 @@
                                                               ctx->mod_def), cleanup);
                 node->flags |= LYS_SET_DFLT;
             } else if (node->nodetype == LYS_CHOICE) {
-                if (((struct lysc_node_choice*)node)->dflt) {
+                if (((struct lysc_node_choice *)node)->dflt) {
                     /* unset LYS_SET_DFLT from the current default case */
-                    ((struct lysc_node_choice*)node)->dflt->flags &= ~LYS_SET_DFLT;
+                    ((struct lysc_node_choice *)node)->dflt->flags &= ~LYS_SET_DFLT;
                 }
-                LY_CHECK_GOTO(lys_compile_node_choice_dflt(ctx, rfn->dflts[0], (struct lysc_node_choice*)node), cleanup);
+                LY_CHECK_GOTO(lys_compile_node_choice_dflt(ctx, rfn->dflts[0], (struct lysc_node_choice *)node), cleanup);
             }
         }
 
@@ -4887,20 +4887,20 @@
         if (rfn->musts) {
             switch (node->nodetype) {
             case LYS_LEAF:
-                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_leaf*)node)->musts, u, lys_compile_must, ret, cleanup);
+                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_leaf *)node)->musts, u, lys_compile_must, ret, cleanup);
                 break;
             case LYS_LEAFLIST:
-                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_leaflist*)node)->musts, u, lys_compile_must, ret, cleanup);
+                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_leaflist *)node)->musts, u, lys_compile_must, ret, cleanup);
                 break;
             case LYS_LIST:
-                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_list*)node)->musts, u, lys_compile_must, ret, cleanup);
+                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_list *)node)->musts, u, lys_compile_must, ret, cleanup);
                 break;
             case LYS_CONTAINER:
-                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_container*)node)->musts, u, lys_compile_must, ret, cleanup);
+                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_container *)node)->musts, u, lys_compile_must, ret, cleanup);
                 break;
             case LYS_ANYXML:
             case LYS_ANYDATA:
-                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_anydata*)node)->musts, u, lys_compile_must, ret, cleanup);
+                COMPILE_ARRAY_GOTO(ctx, rfn->musts, ((struct lysc_node_anydata *)node)->musts, u, lys_compile_must, ret, cleanup);
                 break;
             default:
                 LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS,
@@ -4916,10 +4916,10 @@
             switch (node->nodetype) {
             case LYS_LEAFLIST:
                 if (rfn->flags & LYS_SET_MAX) {
-                    ((struct lysc_node_leaflist*)node)->max = rfn->max ? rfn->max : (uint32_t)-1;
+                    ((struct lysc_node_leaflist *)node)->max = rfn->max ? rfn->max : (uint32_t)-1;
                 }
                 if (rfn->flags & LYS_SET_MIN) {
-                    ((struct lysc_node_leaflist*)node)->min = rfn->min;
+                    ((struct lysc_node_leaflist *)node)->min = rfn->min;
                     if (rfn->min) {
                         node->flags |= LYS_MAND_TRUE;
                         lys_compile_mandatory_parents(node->parent, 1);
@@ -4931,10 +4931,10 @@
                 break;
             case LYS_LIST:
                 if (rfn->flags & LYS_SET_MAX) {
-                    ((struct lysc_node_list*)node)->max = rfn->max ? rfn->max : (uint32_t)-1;
+                    ((struct lysc_node_list *)node)->max = rfn->max ? rfn->max : (uint32_t)-1;
                 }
                 if (rfn->flags & LYS_SET_MIN) {
-                    ((struct lysc_node_list*)node)->min = rfn->min;
+                    ((struct lysc_node_list *)node)->min = rfn->min;
                     if (rfn->min) {
                         node->flags |= LYS_MAND_TRUE;
                         lys_compile_mandatory_parents(node->parent, 1);
@@ -4963,13 +4963,13 @@
 
     /* do some additional checks of the changed nodes when all the refines are applied */
     for (uint32_t i = 0; i < refined.count; ++i) {
-        node = (struct lysc_node*)refined.objs[i];
+        node = (struct lysc_node *)refined.objs[i];
         rfn = &uses_p->refines[i];
         lysc_update_path(ctx, NULL, rfn->nodeid);
 
         /* check possible conflict with default value (default added, mandatory left true) */
         if ((node->flags & LYS_MAND_TRUE) &&
-                (((node->nodetype & LYS_CHOICE) && ((struct lysc_node_choice*)node)->dflt) ||
+                (((node->nodetype & LYS_CHOICE) && ((struct lysc_node_choice *)node)->dflt) ||
                 ((node->nodetype & LYS_LEAF) && (node->flags & LYS_SET_DFLT)))) {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS,
                    "Invalid refine of default - the node is mandatory.");
@@ -4978,11 +4978,11 @@
 
         if (rfn->flags & (LYS_SET_MAX | LYS_SET_MIN)) {
             if (node->nodetype == LYS_LIST) {
-                min = ((struct lysc_node_list*)node)->min;
-                max = ((struct lysc_node_list*)node)->max;
+                min = ((struct lysc_node_list *)node)->min;
+                max = ((struct lysc_node_list *)node)->max;
             } else {
-                min = ((struct lysc_node_leaflist*)node)->min;
-                max = ((struct lysc_node_leaflist*)node)->max;
+                min = ((struct lysc_node_leaflist *)node)->min;
+                max = ((struct lysc_node_leaflist *)node)->max;
             }
             if (min > max) {
                 LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS,
@@ -5104,7 +5104,7 @@
         .flags = node_p ? (node_p->flags & LYS_FLAGS_COMPILED_MASK) : 0,
         .module = ctx->mod,
         .sp = NULL, .parent = NULL, .next = NULL,
-        .prev = (struct lysc_node*)&fake_container,
+        .prev = (struct lysc_node *)&fake_container,
         .name = "fake",
         .dsc = NULL, .ref = NULL, .exts = NULL, .iffeatures = NULL, .when = NULL,
         .child = NULL, .musts = NULL, .actions = NULL, .notifs = NULL
@@ -5125,7 +5125,7 @@
 
     lysc_update_path(ctx, NULL, "{grouping}");
     lysc_update_path(ctx, NULL, grp->name);
-    ret = lys_compile_uses(ctx, &fake_uses, (struct lysc_node*)&fake_container, NULL);
+    ret = lys_compile_uses(ctx, &fake_uses, (struct lysc_node *)&fake_container, NULL);
     lysc_update_path(ctx, NULL, NULL);
     lysc_update_path(ctx, NULL, NULL);
 
@@ -5157,7 +5157,7 @@
     struct lysc_node_case *cs = NULL;
     struct lysc_when **when;
     unsigned int u;
-    LY_ERR (*node_compile_spec)(struct lysc_ctx*, struct lysp_node*, struct lysc_node*);
+    LY_ERR (*node_compile_spec)(struct lysc_ctx *, struct lysp_node *, struct lysc_node *);
 
     if (node_p->nodetype != LYS_USES) {
         lysc_update_path(ctx, parent, node_p->name);
@@ -5168,39 +5168,39 @@
 
     switch (node_p->nodetype) {
     case LYS_CONTAINER:
-        node = (struct lysc_node*)calloc(1, sizeof(struct lysc_node_container));
+        node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_container));
         node_compile_spec = lys_compile_node_container;
         break;
     case LYS_LEAF:
-        node = (struct lysc_node*)calloc(1, sizeof(struct lysc_node_leaf));
+        node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_leaf));
         node_compile_spec = lys_compile_node_leaf;
         break;
     case LYS_LIST:
-        node = (struct lysc_node*)calloc(1, sizeof(struct lysc_node_list));
+        node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_list));
         node_compile_spec = lys_compile_node_list;
         break;
     case LYS_LEAFLIST:
-        node = (struct lysc_node*)calloc(1, sizeof(struct lysc_node_leaflist));
+        node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_leaflist));
         node_compile_spec = lys_compile_node_leaflist;
         break;
     case LYS_CHOICE:
-        node = (struct lysc_node*)calloc(1, sizeof(struct lysc_node_choice));
+        node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_choice));
         node_compile_spec = lys_compile_node_choice;
         break;
     case LYS_ANYXML:
     case LYS_ANYDATA:
-        node = (struct lysc_node*)calloc(1, sizeof(struct lysc_node_anydata));
+        node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_anydata));
         node_compile_spec = lys_compile_node_any;
         break;
     case LYS_USES:
         if (parent && parent->nodetype == LYS_CHOICE) {
             assert(node_p->parent->nodetype == LYS_CASE);
             lysc_update_path(ctx, parent, node_p->parent->name);
-            cs = lys_compile_node_case(ctx, node_p->parent, (struct lysc_node_choice*)parent, NULL);
+            cs = lys_compile_node_case(ctx, node_p->parent, (struct lysc_node_choice *)parent, NULL);
             LY_CHECK_ERR_GOTO(!cs, ret = LY_EVALID, error);
         }
 
-        ret = lys_compile_uses(ctx, (struct lysp_node_uses*)node_p, cs ? (struct lysc_node*)cs : parent, &node);
+        ret = lys_compile_uses(ctx, (struct lysp_node_uses *)node_p, cs ? (struct lysc_node *)cs : parent, &node);
         if (cs) {
             cs->child = node;
             lysc_update_path(ctx, NULL, NULL);
@@ -5305,14 +5305,14 @@
             } else {
                 lysc_update_path(ctx, parent, node->name);
             }
-            cs = lys_compile_node_case(ctx, node_p->parent, (struct lysc_node_choice*)parent, node);
+            cs = lys_compile_node_case(ctx, node_p->parent, (struct lysc_node_choice *)parent, node);
             LY_CHECK_ERR_GOTO(!cs, ret = LY_EVALID, error);
             if (uses_status) {}
             /* the postponed status check of the node and its real parent - in case of implicit case,
              * it directly gets the same status flags as the choice;
              * uses_status cannot be applied here since uses cannot be child statement of choice */
             LY_CHECK_GOTO(ret = lys_compile_status(ctx, &node->flags, cs->flags), error);
-            node->parent = (struct lysc_node*)cs;
+            node->parent = (struct lysc_node *)cs;
             lysc_update_path(ctx, parent, node->name);
         } else { /* other than choice */
             lysc_update_path(ctx, parent, node->name);
@@ -5360,15 +5360,15 @@
 
     /* parent's first child */
     if (parent && parent->nodetype == LYS_CHOICE) {
-        cs = (struct lysc_node_case*)node;
+        cs = (struct lysc_node_case *)node;
     } else if (parent && parent->nodetype == LYS_CASE) {
         /* disconnecting some node in a case */
-        cs = (struct lysc_node_case*)parent;
+        cs = (struct lysc_node_case *)parent;
         parent = cs->parent;
-        for (child = cs->child; child && child->parent == (struct lysc_node*)cs; child = child->next) {
+        for (child = cs->child; child && child->parent == (struct lysc_node *)cs; child = child->next) {
             if (child == node) {
                 if (cs->child == child) {
-                    if (!child->next || child->next->parent != (struct lysc_node*)cs) {
+                    if (!child->next || child->next->parent != (struct lysc_node *)cs) {
                         /* case with a single child -> remove also the case */
                         child->parent = NULL;
                         remove_cs = 1;
@@ -5390,24 +5390,24 @@
     if (cs) {
         if (remove_cs) {
             /* cs has only one child which is being also removed */
-            lysc_disconnect((struct lysc_node*)cs);
-            lysc_node_free(cs->module->ctx, (struct lysc_node*)cs);
+            lysc_disconnect((struct lysc_node *)cs);
+            lysc_node_free(cs->module->ctx, (struct lysc_node *)cs);
         } else {
-            if (((struct lysc_node_choice*)parent)->dflt == cs) {
+            if (((struct lysc_node_choice *)parent)->dflt == cs) {
                 /* default case removed */
-                ((struct lysc_node_choice*)parent)->dflt = NULL;
+                ((struct lysc_node_choice *)parent)->dflt = NULL;
             }
-            if (((struct lysc_node_choice*)parent)->cases == cs) {
+            if (((struct lysc_node_choice *)parent)->cases == cs) {
                 /* first case removed */
-                ((struct lysc_node_choice*)parent)->cases = (struct lysc_node_case*)cs->next;
+                ((struct lysc_node_choice *)parent)->cases = (struct lysc_node_case *)cs->next;
             }
             if (cs->child) {
                 /* cs will be removed and disconnected from its siblings, but we have to take care also about its children */
-                if (cs->child->prev->parent != (struct lysc_node*)cs) {
+                if (cs->child->prev->parent != (struct lysc_node *)cs) {
                     prev = cs->child->prev;
                 } /* else all the children are under a single case */
                 LY_LIST_FOR_SAFE(cs->child, next, child) {
-                    if (child->parent != (struct lysc_node*)cs) {
+                    if (child->parent != (struct lysc_node *)cs) {
                         break;
                     }
                     lysc_node_free(node->module->ctx, child);
@@ -5420,7 +5420,7 @@
                         child->prev = prev;
                     } else {
                         /* link from the first child under the cases */
-                        ((struct lysc_node_choice*)cs->parent)->cases->child->prev = prev;
+                        ((struct lysc_node_choice *)cs->parent)->cases->child->prev = prev;
                     }
                 }
             }
@@ -5435,22 +5435,22 @@
         node->next->prev = node->prev;
     } else if (node->nodetype != LYS_CASE) {
         if (parent) {
-            child = (struct lysc_node*)lysc_node_children(parent, node->flags);
+            child = (struct lysc_node *)lysc_node_children(parent, node->flags);
         } else {
             child = modc->data;
         }
         if (child) {
             child->prev = node->prev;
         }
-    } else if (((struct lysc_node_choice*)parent)->cases) {
-        ((struct lysc_node_choice*)parent)->cases->prev = node->prev;
+    } else if (((struct lysc_node_choice *)parent)->cases) {
+        ((struct lysc_node_choice *)parent)->cases->prev = node->prev;
     }
 }
 
 struct lysc_deviation {
     const char *nodeid;
     struct lysc_node *target;      /* target node of the deviation */
-    struct lysp_deviate** deviates;/* sized array of pointers to parsed deviate statements to apply on target */
+    struct lysp_deviate **deviates;/* sized array of pointers to parsed deviate statements to apply on target */
     uint16_t flags;                /* target's flags from lysc_resolve_schema_nodeid() */
     uint8_t not_supported;         /* flag if deviates contains not-supported deviate */
 };
@@ -5658,11 +5658,11 @@
         if (target->nodetype == LYS_LEAFLIST) {
             DEV_CHECK_NONPRESENCE_UINT(struct lysc_node_leaflist *, > 0, min, "min-elements");
             /* change value */
-            ((struct lysc_node_leaflist*)target)->min = d->min;
+            ((struct lysc_node_leaflist *)target)->min = d->min;
         } else if (target->nodetype == LYS_LIST) {
             DEV_CHECK_NONPRESENCE_UINT(struct lysc_node_list *, > 0, min, "min-elements");
             /* change value */
-            ((struct lysc_node_list*)target)->min = d->min;
+            ((struct lysc_node_list *)target)->min = d->min;
         } else {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_DEV_NODETYPE,
                     lys_nodetype2str(target->nodetype), "add", "min-elements");
@@ -5678,11 +5678,11 @@
         if (target->nodetype == LYS_LEAFLIST) {
             DEV_CHECK_NONPRESENCE_UINT(struct lysc_node_leaflist *, < (uint32_t)-1, max, "max-elements");
             /* change value */
-            ((struct lysc_node_leaflist*)target)->max = d->max ? d->max : (uint32_t)-1;
+            ((struct lysc_node_leaflist *)target)->max = d->max ? d->max : (uint32_t)-1;
         } else if (target->nodetype == LYS_LIST) {
             DEV_CHECK_NONPRESENCE_UINT(struct lysc_node_list *, < (uint32_t)-1, max, "max-elements");
             /* change value */
-            ((struct lysc_node_list*)target)->max = d->max ? d->max : (uint32_t)-1;
+            ((struct lysc_node_list *)target)->max = d->max ? d->max : (uint32_t)-1;
         } else {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_DEV_NODETYPE,
                     lys_nodetype2str(target->nodetype), "add", "max-elements");
@@ -5899,15 +5899,15 @@
     /* [units-stmt] */
     if (d->units) {
         DEV_CHECK_NODETYPE(LYS_LEAF | LYS_LEAFLIST, "delete", "units");
-        DEV_CHECK_PRESENCE(struct lysc_node_leaf*, 0, units, "deleting", "units", d->units);
-        if (strcmp(((struct lysc_node_leaf*)target)->units, d->units)) {
+        DEV_CHECK_PRESENCE(struct lysc_node_leaf *, 0, units, "deleting", "units", d->units);
+        if (strcmp(((struct lysc_node_leaf *)target)->units, d->units)) {
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                     "Invalid deviation deleting \"units\" property \"%s\" which does not match the target's property value \"%s\".",
-                    d->units, ((struct lysc_node_leaf*)target)->units);
+                    d->units, ((struct lysc_node_leaf *)target)->units);
             goto cleanup;
         }
-        lydict_remove(ctx->ctx, ((struct lysc_node_leaf*)target)->units);
-        ((struct lysc_node_leaf*)target)->units = NULL;
+        lydict_remove(ctx->ctx, ((struct lysc_node_leaf *)target)->units);
+        ((struct lysc_node_leaf *)target)->units = NULL;
     }
 
     /* *must-stmt */
@@ -5915,23 +5915,23 @@
         switch (target->nodetype) {
         case LYS_CONTAINER:
         case LYS_LIST:
-            DEV_DEL_ARRAY(struct lysc_node_container*, musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
+            DEV_DEL_ARRAY(struct lysc_node_container *, musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
             break;
         case LYS_LEAF:
         case LYS_LEAFLIST:
         case LYS_ANYDATA:
-            DEV_DEL_ARRAY(struct lysc_node_leaf*, musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
+            DEV_DEL_ARRAY(struct lysc_node_leaf *, musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
             break;
         case LYS_NOTIF:
-            DEV_DEL_ARRAY(struct lysc_notif*, musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
+            DEV_DEL_ARRAY(struct lysc_notif *, musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
             break;
         case LYS_RPC:
         case LYS_ACTION:
             if (dev_flags & LYSC_OPT_RPC_INPUT) {
-                DEV_DEL_ARRAY(struct lysc_action*, input.musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
+                DEV_DEL_ARRAY(struct lysc_action *, input.musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
                 break;
             } else if (dev_flags & LYSC_OPT_RPC_OUTPUT) {
-                DEV_DEL_ARRAY(struct lysc_action*, output.musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
+                DEV_DEL_ARRAY(struct lysc_action *, output.musts, musts, .arg, .cond->expr, &, lysc_must_free, "must");
                 break;
             }
         /* fall through */
@@ -5996,7 +5996,7 @@
             break;
         case LYS_CHOICE:
             DEV_CHECK_CARDINALITY(d->dflts, 1, "default");
-            DEV_CHECK_PRESENCE(struct lysc_node_choice*, 0, dflt, "deleting", "default", d->dflts[0]);
+            DEV_CHECK_PRESENCE(struct lysc_node_choice *, 0, dflt, "deleting", "default", d->dflts[0]);
             nodeid = d->dflts[0];
             LY_CHECK_GOTO(ly_parse_nodeid(&nodeid, &prefix, &prefix_len, &name, &name_len), cleanup);
             if (prefix) {
@@ -6007,7 +6007,7 @@
                             "The prefix does not match any imported module of the deviation module.", d->dflts[0]);
                     goto cleanup;
                 }
-                if (mod != ((struct lysc_node_choice*)target)->dflt->module) {
+                if (mod != ((struct lysc_node_choice *)target)->dflt->module) {
                     LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                             "Invalid deviation deleting \"default\" property \"%s\" of choice. "
                             "The prefix does not match the default case's module.", d->dflts[0]);
@@ -6018,14 +6018,14 @@
              * strictly, the default prefix would point to the deviation module, but the value should actually
              * match the default string in the original module (usually unprefixed), so in this case we do not check
              * the module of the default case, just matching its name */
-            if (strcmp(name, ((struct lysc_node_choice*)target)->dflt->name)) {
+            if (strcmp(name, ((struct lysc_node_choice *)target)->dflt->name)) {
                 LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
                         "Invalid deviation deleting \"default\" property \"%s\" of choice does not match the default case name \"%s\".",
-                        d->dflts[0], ((struct lysc_node_choice*)target)->dflt->name);
+                        d->dflts[0], ((struct lysc_node_choice *)target)->dflt->name);
                 goto cleanup;
             }
-            ((struct lysc_node_choice*)target)->dflt->flags &= ~LYS_SET_DFLT;
-            ((struct lysc_node_choice*)target)->dflt = NULL;
+            ((struct lysc_node_choice *)target)->dflt->flags &= ~LYS_SET_DFLT;
+            ((struct lysc_node_choice *)target)->dflt = NULL;
             break;
         default:
             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_DEV_NODETYPE,
@@ -6399,7 +6399,7 @@
         LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS,
                 "Invalid deviation combining default value and mandatory %s.", lys_nodetype2str(target->nodetype));
         goto cleanup;
-    } else if ((target->nodetype & LYS_CHOICE) && ((struct lysc_node_choice*)target)->dflt
+    } else if ((target->nodetype & LYS_CHOICE) && ((struct lysc_node_choice *)target)->dflt
             && (target->flags & LYS_MAND_TRUE)) {
         LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS, "Invalid deviation combining default case and mandatory choice.");
         goto cleanup;
@@ -6459,17 +6459,17 @@
 
         /* resolve the target */
         LY_CHECK_GOTO(lysc_resolve_schema_nodeid(ctx, dev->nodeid, 0, NULL, ctx->mod, 0, 1,
-                (const struct lysc_node**)&target, &flags), cleanup);
+                (const struct lysc_node **)&target, &flags), cleanup);
         if (target->nodetype & (LYS_RPC | LYS_ACTION)) {
             /* move the target pointer to input/output to make them different from the action and
              * between them. Before the devs[] item is being processed, the target pointer must be fixed
              * back to the RPC/action node due to a better compatibility and decision code in this function.
              * The LYSC_OPT_INTERNAL is used as a flag to this change. */
             if (flags & LYSC_OPT_RPC_INPUT) {
-                target = (struct lysc_node*)&((struct lysc_action*)target)->input;
+                target = (struct lysc_node *)&((struct lysc_action *)target)->input;
                 flags |= LYSC_OPT_INTERNAL;
             } else if (flags & LYSC_OPT_RPC_OUTPUT) {
-                target = (struct lysc_node*)&((struct lysc_action*)target)->output;
+                target = (struct lysc_node *)&((struct lysc_action *)target)->output;
                 flags |= LYSC_OPT_INTERNAL;
             }
         }
@@ -6661,21 +6661,21 @@
 
                     if (substmts[u].cardinality < LY_STMT_CARD_SOME) {
                         /* single item */
-                        if (*(struct lysc_type**)substmts[u].storage) {
+                        if (*(struct lysc_type **)substmts[u].storage) {
                             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_DUPSTMT, stmt->stmt);
                             goto cleanup;
                         }
                         compiled = substmts[u].storage;
                     } else {
                         /* sized array */
-                        struct lysc_type ***types = (struct lysc_type***)substmts[u].storage, **type = NULL;
+                        struct lysc_type ***types = (struct lysc_type ***)substmts[u].storage, **type = NULL;
                         LY_ARRAY_NEW_GOTO(ctx->ctx, *types, type, ret, cleanup);
-                        compiled = (void*)type;
+                        compiled = (void *)type;
                     }
 
                     LY_CHECK_ERR_GOTO(r = lysp_stmt_parse(ctx, stmt, stmt->kw, &parsed, NULL), ret = r, cleanup);
-                    LY_CHECK_ERR_GOTO(r = lys_compile_type(ctx, ext->parent_type == LYEXT_PAR_NODE ? ((struct lysc_node*)ext->parent)->sp : NULL,
-                                      flags ? *flags : 0, ctx->mod_def->parsed, ext->name, parsed, (struct lysc_type**)compiled,
+                    LY_CHECK_ERR_GOTO(r = lys_compile_type(ctx, ext->parent_type == LYEXT_PAR_NODE ? ((struct lysc_node *)ext->parent)->sp : NULL,
+                                      flags ? *flags : 0, ctx->mod_def->parsed, ext->name, parsed, (struct lysc_type **)compiled,
                                       units && !*units ? units : NULL, NULL, NULL), lysp_type_free(ctx->ctx, parsed); free(parsed); ret = r, cleanup);
                     lysp_type_free(ctx->ctx, parsed);
                     free(parsed);
@@ -6686,14 +6686,14 @@
 
                     if (substmts[u].cardinality < LY_STMT_CARD_SOME) {
                         /* single item */
-                        if (((struct lysc_iffeature*)substmts[u].storage)->features) {
+                        if (((struct lysc_iffeature *)substmts[u].storage)->features) {
                             LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_DUPSTMT, stmt->stmt);
                             goto cleanup;
                         }
-                        iff = (struct lysc_iffeature*)substmts[u].storage;
+                        iff = (struct lysc_iffeature *)substmts[u].storage;
                     } else {
                         /* sized array */
-                        struct lysc_iffeature **iffs = (struct lysc_iffeature**)substmts[u].storage;
+                        struct lysc_iffeature **iffs = (struct lysc_iffeature **)substmts[u].storage;
                         LY_ARRAY_NEW_GOTO(ctx->ctx, *iffs, iff, ret, cleanup);
                     }
                     LY_CHECK_ERR_GOTO(r = lys_compile_iffeature(ctx, &stmt->arg, iff), ret = r, cleanup);
@@ -7207,17 +7207,17 @@
         /* store pointer to the real type */
         type = ((struct lysc_node_leaf *)ctx->leafrefs.objs[i])->type;
         if (type->basetype == LY_TYPE_LEAFREF) {
-            for (typeiter = ((struct lysc_type_leafref*)type)->realtype;
+            for (typeiter = ((struct lysc_type_leafref *)type)->realtype;
                     typeiter->basetype == LY_TYPE_LEAFREF;
-                    typeiter = ((struct lysc_type_leafref*)typeiter)->realtype) {}
-            ((struct lysc_type_leafref*)type)->realtype = typeiter;
+                    typeiter = ((struct lysc_type_leafref *)typeiter)->realtype) {}
+            ((struct lysc_type_leafref *)type)->realtype = typeiter;
         } else if (type->basetype == LY_TYPE_UNION) {
-            LY_ARRAY_FOR(((struct lysc_type_union*)type)->types, v) {
-                if (((struct lysc_type_union*)type)->types[v]->basetype == LY_TYPE_LEAFREF) {
-                    for (typeiter = ((struct lysc_type_leafref*)((struct lysc_type_union*)type)->types[v])->realtype;
+            LY_ARRAY_FOR(((struct lysc_type_union *)type)->types, v) {
+                if (((struct lysc_type_union *)type)->types[v]->basetype == LY_TYPE_LEAFREF) {
+                    for (typeiter = ((struct lysc_type_leafref *)((struct lysc_type_union *)type)->types[v])->realtype;
                             typeiter->basetype == LY_TYPE_LEAFREF;
-                            typeiter = ((struct lysc_type_leafref*)typeiter)->realtype) {}
-                    ((struct lysc_type_leafref*)((struct lysc_type_union*)type)->types[v])->realtype = typeiter;
+                            typeiter = ((struct lysc_type_leafref *)typeiter)->realtype) {}
+                    ((struct lysc_type_leafref *)((struct lysc_type_union *)type)->types[v])->realtype = typeiter;
                 }
             }
         }
@@ -7368,7 +7368,7 @@
         }
     }
     LY_LIST_FOR(sp->data, node_p) {
-        grps = (struct lysp_grp*)lysp_node_groupings(node_p);
+        grps = (struct lysp_grp *)lysp_node_groupings(node_p);
         LY_ARRAY_FOR(grps, u) {
             if (!(grps[u].flags & LYS_USED_GRP)) {
                 LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, node_p, &grps[u]), error);
