plugins exts UPDATE require ext storage to be a pointer

There are no other use-cases anyway and it being
a uint64_t number causes issues on 32b platforms.
diff --git a/src/context.c b/src/context.c
index 912f56d..2345cf2 100644
--- a/src/context.c
+++ b/src/context.c
@@ -721,7 +721,7 @@
                 ext = &mod->compiled->exts[u];
                 LY_ARRAY_FOR(ext->substmts, v) {
                     if (ext->substmts[v].stmt & LY_STMT_DATA_NODE_MASK) {
-                        LY_LIST_FOR(*VOIDPTR2_C(ext->substmts[v].storage), root) {
+                        LY_LIST_FOR(*ext->substmts[v].storage_p, root) {
                             lysc_tree_dfs_full(root, lysc_node_clear_priv_dfs_cb, NULL);
                         }
                     }
diff --git a/src/ly_common.h b/src/ly_common.h
index 8dc32d7..ec0d3ea 100644
--- a/src/ly_common.h
+++ b/src/ly_common.h
@@ -61,9 +61,6 @@
 #define GETMACRO6(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
 #define GETMACRO7(_1, _2, _3, _4, _5, _6, _7, NAME, ...) NAME
 
-#define VOIDPTR_C(var) ((void *)(uintptr_t)(var))
-#define VOIDPTR2_C(var) ((void **)(uintptr_t)(var))
-
 /******************************************************************************
  * Logger
  *****************************************************************************/
diff --git a/src/parser_common.c b/src/parser_common.c
index 290e3a5..c164fdf 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -3559,7 +3559,7 @@
 {
     LY_ERR rc = LY_SUCCESS;
 
-    if (!substmt->storage) {
+    if (!substmt->storage_p) {
         /* nothing to parse, ignored */
         goto cleanup;
     }
@@ -3587,7 +3587,7 @@
         LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)&pnode, NULL), cleanup);
 
         /* usually is a linked-list of all the parsed schema nodes */
-        pnodes_p = VOIDPTR_C(substmt->storage);
+        pnodes_p = (struct lysp_node **)substmt->storage_p;
         while (*pnodes_p) {
             pnodes_p = &(*pnodes_p)->next;
         }
@@ -3615,7 +3615,7 @@
     case LY_STMT_TYPEDEF:
     case LY_STMT_UNIQUE:
         /* parse, sized array */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
         break;
 
     case LY_STMT_ARGUMENT:
@@ -3650,50 +3650,50 @@
     case LY_STMT_YANG_VERSION:
     case LY_STMT_YIN_ELEMENT:
         /* single item */
-        if (*VOIDPTR2_C(substmt->storage)) {
+        if (*substmt->storage_p) {
             LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
             rc = LY_EVALID;
             goto cleanup;
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
         break;
 
     case LY_STMT_CONFIG:
         /* single item */
-        if ((*(uint16_t *)VOIDPTR2_C(substmt->storage)) & LYS_CONFIG_MASK) {
+        if ((*(uint16_t *)substmt->storage_p) & LYS_CONFIG_MASK) {
             LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
             rc = LY_EVALID;
             goto cleanup;
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
         break;
 
     case LY_STMT_ORDERED_BY:
         /* single item */
-        if ((*(uint16_t *)VOIDPTR2_C(substmt->storage)) & LYS_ORDBY_MASK) {
+        if ((*(uint16_t *)substmt->storage_p) & LYS_ORDBY_MASK) {
             LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
             rc = LY_EVALID;
             goto cleanup;
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
         break;
 
     case LY_STMT_STATUS:
         /* single item */
-        if ((*(uint16_t *)VOIDPTR2_C(substmt->storage)) & LYS_STATUS_MASK) {
+        if ((*(uint16_t *)substmt->storage_p) & LYS_STATUS_MASK) {
             LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
             rc = LY_EVALID;
             goto cleanup;
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
         break;
 
     default:
diff --git a/src/plugins_exts.c b/src/plugins_exts.c
index cd9a420..3ac19dc 100644
--- a/src/plugins_exts.c
+++ b/src/plugins_exts.c
@@ -81,34 +81,34 @@
  * @brief Compile an instance extension statement.
  *
  * @param[in] ctx Compile context.
- * @param[in] parsed Parsed ext instance substatement structure.
+ * @param[in] parsed_p Parsed ext instance substatement structure.
  * @param[in] ext Compiled ext instance.
  * @param[in] substmt Compled ext instance substatement info.
  * @return LY_ERR value.
  */
 static LY_ERR
-lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, void *parsed, struct lysc_ext_instance *ext,
+lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, void **parsed_p, struct lysc_ext_instance *ext,
         struct lysc_ext_substmt *substmt)
 {
     LY_ERR rc = LY_SUCCESS;
     ly_bool length_restr = 0;
     LY_DATA_TYPE basetype;
 
-    assert(parsed);
+    assert(*parsed_p);
 
     /* compilation wthout any storage */
     if (substmt->stmt == LY_STMT_IF_FEATURE) {
         ly_bool enabled;
 
         /* evaluate */
-        LY_CHECK_GOTO(rc = lys_eval_iffeatures(ctx->ctx, VOIDPTR_C(parsed), &enabled), cleanup);
+        LY_CHECK_GOTO(rc = lys_eval_iffeatures(ctx->ctx, *parsed_p, &enabled), cleanup);
         if (!enabled) {
             /* it is disabled, remove the whole extension instance */
             rc = LY_ENOT;
         }
     }
 
-    if (!substmt->storage) {
+    if (!substmt->storage_p) {
         /* nothing to store */
         goto cleanup;
     }
@@ -133,7 +133,7 @@
         struct lysc_node *node;
 
         lyplg_ext_get_storage(ext, LY_STMT_STATUS, sizeof flags, (const void **)&flags);
-        pnodes = VOIDPTR_C(parsed);
+        pnodes = *parsed_p;
 
         /* compile nodes */
         LY_LIST_FOR(pnodes, pnode) {
@@ -163,7 +163,7 @@
     case LY_STMT_REFERENCE:
     case LY_STMT_UNITS:
         /* just make a copy */
-        LY_CHECK_GOTO(rc = lydict_insert(ctx->ctx, VOIDPTR_C(parsed), 0, VOIDPTR_C(substmt->storage)), cleanup);
+        LY_CHECK_GOTO(rc = lydict_insert(ctx->ctx, *parsed_p, 0, (const char **)substmt->storage_p), cleanup);
         break;
 
     case LY_STMT_BIT:
@@ -175,7 +175,7 @@
         }
 
         /* compile */
-        rc = lys_compile_type_enums(ctx, VOIDPTR_C(parsed), basetype, NULL, VOIDPTR_C(substmt->storage));
+        rc = lys_compile_type_enums(ctx, *parsed_p, basetype, NULL, (struct lysc_type_bitenum_item **)substmt->storage_p);
         LY_CHECK_GOTO(rc, cleanup);
         break;
 
@@ -183,7 +183,7 @@
         uint16_t flags;
 
         if (!(ctx->compile_opts & LYS_COMPILE_NO_CONFIG)) {
-            memcpy(&flags, &parsed, 2);
+            memcpy(&flags, parsed_p, 2);
             if (flags & LYS_CONFIG_MASK) {
                 /* explicitly set */
                 flags |= LYS_SET_CONFIG;
@@ -194,56 +194,56 @@
                 /* default config */
                 flags = LYS_CONFIG_W;
             }
-            memcpy(VOIDPTR_C(substmt->storage), &flags, 2);
+            memcpy(substmt->storage_p, &flags, 2);
         } /* else leave zero */
         break;
     }
     case LY_STMT_MUST: {
-        const struct lysp_restr *restrs = VOIDPTR_C(parsed);
+        const struct lysp_restr *restrs = *parsed_p;
 
         /* sized array */
-        COMPILE_ARRAY_GOTO(ctx, restrs, *(struct lysc_must **)VOIDPTR_C(substmt->storage), lys_compile_must, rc, cleanup);
+        COMPILE_ARRAY_GOTO(ctx, restrs, *(struct lysc_must **)substmt->storage_p, lys_compile_must, rc, cleanup);
         break;
     }
     case LY_STMT_WHEN: {
         const uint16_t flags;
-        const struct lysp_when *when = VOIDPTR_C(parsed);
+        const struct lysp_when *when = *parsed_p;
 
         /* read compiled status */
         lyplg_ext_get_storage(ext, LY_STMT_STATUS, sizeof flags, (const void **)&flags);
 
         /* compile */
-        LY_CHECK_GOTO(rc = lys_compile_when(ctx, when, flags, NULL, NULL, NULL, VOIDPTR_C(substmt->storage)), cleanup);
+        LY_CHECK_GOTO(rc = lys_compile_when(ctx, when, flags, NULL, NULL, NULL, (struct lysc_when **)substmt->storage_p), cleanup);
         break;
     }
     case LY_STMT_FRACTION_DIGITS:
     case LY_STMT_REQUIRE_INSTANCE:
         /* just make a copy */
-        memcpy(VOIDPTR_C(substmt->storage), &parsed, 1);
+        memcpy(substmt->storage_p, parsed_p, 1);
         break;
 
     case LY_STMT_MANDATORY:
     case LY_STMT_ORDERED_BY:
     case LY_STMT_STATUS:
         /* just make a copy */
-        memcpy(VOIDPTR_C(substmt->storage), &parsed, 2);
+        memcpy(substmt->storage_p, parsed_p, 2);
         break;
 
     case LY_STMT_MAX_ELEMENTS:
     case LY_STMT_MIN_ELEMENTS:
         /* just make a copy */
-        memcpy(VOIDPTR_C(substmt->storage), &parsed, 4);
+        memcpy(substmt->storage_p, parsed_p, 4);
         break;
 
     case LY_STMT_POSITION:
     case LY_STMT_VALUE:
         /* just make a copy */
-        memcpy(VOIDPTR_C(substmt->storage), &parsed, 8);
+        memcpy(substmt->storage_p, parsed_p, 8);
         break;
 
     case LY_STMT_IDENTITY:
         /* compile */
-        rc = lys_identity_precompile(ctx, NULL, NULL, VOIDPTR_C(parsed), VOIDPTR_C(substmt->storage));
+        rc = lys_identity_precompile(ctx, NULL, NULL, *parsed_p, (struct lysc_ident **)substmt->storage_p);
         LY_CHECK_GOTO(rc, cleanup);
         break;
 
@@ -252,36 +252,36 @@
     /* fallthrough */
     case LY_STMT_RANGE:
         /* compile, use uint64 default range */
-        rc = lys_compile_type_range(ctx, VOIDPTR_C(parsed), LY_TYPE_UINT64, length_restr, 0, NULL, VOIDPTR_C(substmt->storage));
+        rc = lys_compile_type_range(ctx, *parsed_p, LY_TYPE_UINT64, length_restr, 0, NULL, (struct lysc_range **)substmt->storage_p);
         LY_CHECK_GOTO(rc, cleanup);
         break;
 
     case LY_STMT_PATTERN:
         /* compile */
-        rc = lys_compile_type_patterns(ctx, VOIDPTR_C(parsed), NULL, VOIDPTR_C(substmt->storage));
+        rc = lys_compile_type_patterns(ctx, *parsed_p, NULL, (struct lysc_pattern ***)substmt->storage_p);
         LY_CHECK_GOTO(rc, cleanup);
         break;
 
     case LY_STMT_TYPE: {
         const uint16_t flags;
         const char *units;
-        const struct lysp_type *ptype = VOIDPTR_C(parsed);
+        const struct lysp_type *ptype = *parsed_p;
 
         /* read compiled info */
         lyplg_ext_get_storage(ext, LY_STMT_STATUS, sizeof flags, (const void **)&flags);
         lyplg_ext_get_storage(ext, LY_STMT_UNITS, sizeof units, (const void **)&units);
 
         /* compile */
-        rc = lys_compile_type(ctx, NULL, flags, ext->def->name, ptype, VOIDPTR_C(substmt->storage), &units, NULL);
+        rc = lys_compile_type(ctx, NULL, flags, ext->def->name, ptype, (struct lysc_type **)substmt->storage_p, &units, NULL);
         LY_CHECK_GOTO(rc, cleanup);
-        LY_ATOMIC_INC_BARRIER((*(struct lysc_type **)VOIDPTR_C(substmt->storage))->refcount);
+        LY_ATOMIC_INC_BARRIER((*(struct lysc_type **)substmt->storage_p)->refcount);
         break;
     }
     case LY_STMT_EXTENSION_INSTANCE: {
-        struct lysp_ext_instance *extps = VOIDPTR_C(parsed);
+        struct lysp_ext_instance *extps = *parsed_p;
 
         /* compile sized array */
-        COMPILE_EXTS_GOTO(ctx, extps, *(struct lysc_ext_instance **)VOIDPTR_C(substmt->storage), ext, rc, cleanup);
+        COMPILE_EXTS_GOTO(ctx, extps, *(struct lysc_ext_instance **)substmt->storage_p, ext, rc, cleanup);
         break;
     }
     case LY_STMT_AUGMENT:
@@ -330,7 +330,7 @@
     LY_ERR rc = LY_SUCCESS;
     LY_ARRAY_COUNT_TYPE u, v;
     enum ly_stmt stmtp;
-    void *storagep;
+    void **storagep;
     struct ly_set storagep_compiled = {0};
 
     LY_CHECK_ARG_RET(ctx ? ctx->ctx : NULL, ctx, extp, ext, LY_EINVAL);
@@ -340,9 +340,9 @@
 
     LY_ARRAY_FOR(extp->substmts, u) {
         stmtp = extp->substmts[u].stmt;
-        storagep = *VOIDPTR2_C(extp->substmts[u].storage);
+        storagep = extp->substmts[u].storage_p;
 
-        if (!storagep || ly_set_contains(&storagep_compiled, VOIDPTR_C(storagep), NULL)) {
+        if (!*storagep || ly_set_contains(&storagep_compiled, storagep, NULL)) {
             /* nothing parsed or already compiled (for example, if it is a linked list of parsed nodes) */
             continue;
         }
@@ -361,7 +361,7 @@
         }
 
         /* compiled */
-        ly_set_add(&storagep_compiled, VOIDPTR_C(storagep), 1, NULL);
+        ly_set_add(&storagep_compiled, storagep, 1, NULL);
     }
 
 cleanup:
@@ -437,7 +437,7 @@
         case LY_STMT_LEAF:
         case LY_STMT_LEAF_LIST:
         case LY_STMT_LIST:
-            schema = *VOIDPTR2_C(ext->substmts[i].storage);
+            schema = *ext->substmts[i].storage_p;
             if (schema) {
                 rc = lyplg_ext_sprinter_ctree_add_nodes(ctx, schema, clb);
                 return rc;
@@ -475,7 +475,7 @@
         case LY_STMT_LEAF:
         case LY_STMT_LEAF_LIST:
         case LY_STMT_LIST:
-            schema = *VOIDPTR2_C(ext->substmts[i].storage);
+            schema = *ext->substmts[i].storage_p;
             if (schema) {
                 rc = lyplg_ext_sprinter_ptree_add_nodes(ctx, schema, clb);
                 return rc;
@@ -587,12 +587,12 @@
 }
 
 LY_ERR
-lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, uint64_t *storage_p)
+lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, void ***storage_pp)
 {
     LY_ARRAY_COUNT_TYPE u;
     enum ly_stmt match = 0;
 
-    *storage_p = 0;
+    *storage_pp = NULL;
 
     if (!(stmt & LY_STMT_NODE_MASK)) {
         /* matching a non-node statement */
@@ -601,7 +601,7 @@
 
     LY_ARRAY_FOR(ext->substmts, u) {
         if ((match && (ext->substmts[u].stmt == match)) || (!match && (ext->substmts[u].stmt & stmt))) {
-            *storage_p = ext->substmts[u].storage;
+            *storage_pp = ext->substmts[u].storage_p;
             return LY_SUCCESS;
         }
     }
@@ -613,14 +613,14 @@
 lyplg_ext_get_storage(const struct lysc_ext_instance *ext, int stmt, uint32_t storage_size, const void **storage)
 {
     LY_ERR rc = LY_SUCCESS;
-    uint64_t s;
+    void **s_p;
 
     /* get pointer to the storage, is set even on error */
-    rc = lyplg_ext_get_storage_p(ext, stmt, &s);
+    rc = lyplg_ext_get_storage_p(ext, stmt, &s_p);
 
     /* assign */
-    if (s) {
-        memcpy(storage, VOIDPTR_C(s), storage_size);
+    if (s_p) {
+        memcpy(storage, s_p, storage_size);
     } else {
         memset(storage, 0, storage_size);
     }
@@ -634,7 +634,7 @@
     LY_ARRAY_COUNT_TYPE u;
     const struct lysp_ext_instance *extp = NULL;
     enum ly_stmt match = 0;
-    uint64_t s = 0;
+    void **s_p = NULL;
 
     /* find the parsed ext instance */
     LY_ARRAY_FOR(ext->module->parsed->exts, u) {
@@ -655,14 +655,14 @@
     /* get the substatement */
     LY_ARRAY_FOR(extp->substmts, u) {
         if ((match && (extp->substmts[u].stmt == match)) || (!match && (extp->substmts[u].stmt & stmt))) {
-            s = extp->substmts[u].storage;
+            s_p = extp->substmts[u].storage_p;
             break;
         }
     }
 
     /* assign */
-    if (s) {
-        memcpy(storage, VOIDPTR_C(s), storage_size);
+    if (s_p) {
+        memcpy(storage, s_p, storage_size);
     } else {
         memset(storage, 0, storage_size);
     }
diff --git a/src/plugins_exts.h b/src/plugins_exts.h
index d75efae..4cf80b2 100644
--- a/src/plugins_exts.h
+++ b/src/plugins_exts.h
@@ -109,7 +109,7 @@
 /**
  * @brief Extensions API version
  */
-#define LYPLG_EXT_API_VERSION 7
+#define LYPLG_EXT_API_VERSION 8
 
 /**
  * @brief Mask for an operation statement.
@@ -393,7 +393,7 @@
  */
 struct lysp_ext_substmt {
     enum ly_stmt stmt;  /**< parsed substatement */
-    uint64_t storage;   /**< (pointer to) the parsed storage of the statement according to the specific
+    void **storage_p;   /**< pointer to the parsed storage of the statement according to the specific
                              lys_ext_substmt::stmt */
 };
 
@@ -427,7 +427,7 @@
  */
 struct lysc_ext_substmt {
     enum ly_stmt stmt;  /**< compiled substatement */
-    uint64_t storage;   /**< (pointer to) the compiled storage of the statement according to the specific
+    void **storage_p;   /**< pointer to the compiled storage of the statement according to the specific
                              lys_ext_substmt::stmt */
 };
 
diff --git a/src/plugins_exts/metadata.c b/src/plugins_exts/metadata.c
index aa6cb43..baec86f 100644
--- a/src/plugins_exts/metadata.c
+++ b/src/plugins_exts/metadata.c
@@ -79,27 +79,27 @@
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_IF_FEATURE;
-    ext->substmts[0].storage = (uint64_t)(uintptr_t)&ann_pdata->iffeatures;
+    ext->substmts[0].storage_p = (void **)&ann_pdata->iffeatures;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_UNITS;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&ann_pdata->units;
+    ext->substmts[1].storage_p = (void **)&ann_pdata->units;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_STATUS;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&ann_pdata->flags;
+    ext->substmts[2].storage_p = (void **)&ann_pdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_TYPE;
-    ext->substmts[3].storage = (uint64_t)(uintptr_t)&ann_pdata->type;
+    ext->substmts[3].storage_p = (void **)&ann_pdata->type;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[4].storage = (uint64_t)(uintptr_t)&ann_pdata->dsc;
+    ext->substmts[4].storage_p = (void **)&ann_pdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_REFERENCE;
-    ext->substmts[5].storage = (uint64_t)(uintptr_t)&ann_pdata->ref;
+    ext->substmts[5].storage_p = (void **)&ann_pdata->ref;
 
     if ((r = lyplg_ext_parse_extension_instance(pctx, ext))) {
         return r;
@@ -139,27 +139,27 @@
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_IF_FEATURE;
-    ext->substmts[0].storage = 0;
+    ext->substmts[0].storage_p = NULL;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_UNITS;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&ann_cdata->units;
+    ext->substmts[1].storage_p = (void **)&ann_cdata->units;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_STATUS;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&ann_cdata->flags;
+    ext->substmts[2].storage_p = (void **)&ann_cdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_TYPE;
-    ext->substmts[3].storage = (uint64_t)(uintptr_t)&ann_cdata->type;
+    ext->substmts[3].storage_p = (void **)&ann_cdata->type;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[4].storage = (uint64_t)(uintptr_t)&ann_cdata->dsc;
+    ext->substmts[4].storage_p = (void **)&ann_cdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_REFERENCE;
-    ext->substmts[5].storage = (uint64_t)(uintptr_t)&ann_cdata->ref;
+    ext->substmts[5].storage_p = (void **)&ann_cdata->ref;
 
     ret = lyplg_ext_compile_extension_instance(cctx, extp, ext);
     return ret;
diff --git a/src/plugins_exts/structure.c b/src/plugins_exts/structure.c
index bc2ea0e..6aa902e 100644
--- a/src/plugins_exts/structure.c
+++ b/src/plugins_exts/structure.c
@@ -90,60 +90,60 @@
     /* parse substatements */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_MUST;
-    ext->substmts[0].storage = (uint64_t)(uintptr_t)&struct_pdata->musts;
+    ext->substmts[0].storage_p = (void **)&struct_pdata->musts;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_STATUS;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&struct_pdata->flags;
+    ext->substmts[1].storage_p = (void **)&struct_pdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&struct_pdata->dsc;
+    ext->substmts[2].storage_p = (void **)&struct_pdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_REFERENCE;
-    ext->substmts[3].storage = (uint64_t)(uintptr_t)&struct_pdata->ref;
+    ext->substmts[3].storage_p = (void **)&struct_pdata->ref;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_TYPEDEF;
-    ext->substmts[4].storage = (uint64_t)(uintptr_t)&struct_pdata->typedefs;
+    ext->substmts[4].storage_p = (void **)&struct_pdata->typedefs;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_GROUPING;
-    ext->substmts[5].storage = (uint64_t)(uintptr_t)&struct_pdata->groupings;
+    ext->substmts[5].storage_p = (void **)&struct_pdata->groupings;
 
     /* data-def-stmt */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[6].stmt = LY_STMT_CONTAINER;
-    ext->substmts[6].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[6].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[7].stmt = LY_STMT_LEAF;
-    ext->substmts[7].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[7].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
-    ext->substmts[8].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[8].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[9].stmt = LY_STMT_LIST;
-    ext->substmts[9].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[9].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[10].stmt = LY_STMT_CHOICE;
-    ext->substmts[10].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[10].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[11].stmt = LY_STMT_ANYDATA;
-    ext->substmts[11].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[11].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[12].stmt = LY_STMT_ANYXML;
-    ext->substmts[12].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[12].storage_p = (void **)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[13].stmt = LY_STMT_USES;
-    ext->substmts[13].storage = (uint64_t)(uintptr_t)&struct_pdata->child;
+    ext->substmts[13].storage_p = (void **)&struct_pdata->child;
 
     rc = lyplg_ext_parse_extension_instance(pctx, ext);
     return rc;
@@ -190,60 +190,60 @@
     LY_ARRAY_CREATE_GOTO(cctx->ctx, ext->substmts, 14, rc, emem);
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_MUST;
-    ext->substmts[0].storage = (uint64_t)(uintptr_t)&struct_cdata->musts;
+    ext->substmts[0].storage_p = (void **)&struct_cdata->musts;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_STATUS;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&struct_cdata->flags;
+    ext->substmts[1].storage_p = (void **)&struct_cdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&struct_cdata->dsc;
+    ext->substmts[2].storage_p = (void **)&struct_cdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_REFERENCE;
-    ext->substmts[3].storage = (uint64_t)(uintptr_t)&struct_cdata->ref;
+    ext->substmts[3].storage_p = (void **)&struct_cdata->ref;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_TYPEDEF;
-    ext->substmts[4].storage = 0;
+    ext->substmts[4].storage_p = 0;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_GROUPING;
-    ext->substmts[5].storage = 0;
+    ext->substmts[5].storage_p = 0;
 
     /* data-def-stmt */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[6].stmt = LY_STMT_CONTAINER;
-    ext->substmts[6].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[6].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[7].stmt = LY_STMT_LEAF;
-    ext->substmts[7].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[7].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
-    ext->substmts[8].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[8].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[9].stmt = LY_STMT_LIST;
-    ext->substmts[9].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[9].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[10].stmt = LY_STMT_CHOICE;
-    ext->substmts[10].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[10].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[11].stmt = LY_STMT_ANYDATA;
-    ext->substmts[11].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[11].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[12].stmt = LY_STMT_ANYXML;
-    ext->substmts[12].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[12].storage_p = (void **)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[13].stmt = LY_STMT_USES;
-    ext->substmts[13].storage = (uint64_t)(uintptr_t)&struct_cdata->child;
+    ext->substmts[13].storage_p = (void **)&struct_cdata->child;
 
     *lyplg_ext_compile_get_options(cctx) |= LYS_COMPILE_NO_CONFIG | LYS_COMPILE_NO_DISABLED;
     rc = lyplg_ext_compile_extension_instance(cctx, extp, ext);
@@ -339,53 +339,53 @@
     /* parse substatements */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_STATUS;
-    ext->substmts[0].storage = (uint64_t)(uintptr_t)&aug_pdata->flags;
+    ext->substmts[0].storage_p = (void **)&aug_pdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&aug_pdata->dsc;
+    ext->substmts[1].storage_p = (void **)&aug_pdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_REFERENCE;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&aug_pdata->ref;
+    ext->substmts[2].storage_p = (void **)&aug_pdata->ref;
 
     /* data-def-stmt */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_CONTAINER;
-    ext->substmts[3].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[3].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_LEAF;
-    ext->substmts[4].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[4].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_LEAF_LIST;
-    ext->substmts[5].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[5].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[6].stmt = LY_STMT_LIST;
-    ext->substmts[6].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[6].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[7].stmt = LY_STMT_CHOICE;
-    ext->substmts[7].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[7].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[8].stmt = LY_STMT_ANYDATA;
-    ext->substmts[8].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[8].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[9].stmt = LY_STMT_ANYXML;
-    ext->substmts[9].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[9].storage_p = (void **)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[10].stmt = LY_STMT_USES;
-    ext->substmts[10].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[10].storage_p = (void **)&aug_pdata->child;
 
     /* case */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[11].stmt = LY_STMT_CASE;
-    ext->substmts[11].storage = (uint64_t)(uintptr_t)&aug_pdata->child;
+    ext->substmts[11].storage_p = (void **)&aug_pdata->child;
 
     if ((rc = lyplg_ext_parse_extension_instance(pctx, ext))) {
         return rc;
@@ -394,7 +394,7 @@
     /* add fake parsed augment node */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[12].stmt = LY_STMT_AUGMENT;
-    ext->substmts[12].storage = (uint64_t)(uintptr_t)&aug_pdata->aug;
+    ext->substmts[12].storage_p = (void **)&aug_pdata->aug;
 
     aug_pdata->aug = calloc(1, sizeof *aug_pdata->aug);
     if (!aug_pdata->aug) {
@@ -476,7 +476,7 @@
 
     assert(ctx);
 
-    aug = (struct lysp_node_augment **)(uintptr_t)ext->substmts[12].storage;
+    aug = (struct lysp_node_augment **)ext->substmts[12].storage_p;
     rc = lyplg_ext_sprinter_ptree_add_nodes(ctx, (*aug)->child, structure_sprinter_pnode);
 
     return rc;
diff --git a/src/plugins_exts/yangdata.c b/src/plugins_exts/yangdata.c
index c9c5dd8..1736abc 100644
--- a/src/plugins_exts/yangdata.c
+++ b/src/plugins_exts/yangdata.c
@@ -58,15 +58,15 @@
     LY_ARRAY_CREATE_GOTO(lyplg_ext_parse_get_cur_pmod(pctx)->mod->ctx, ext->substmts, 3, ret, emem);
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_CONTAINER;
-    ext->substmts[0].storage = (uint64_t)(uintptr_t)&ext->parsed;
+    ext->substmts[0].storage_p = (void **)&ext->parsed;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_CHOICE;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&ext->parsed;
+    ext->substmts[1].storage_p = (void **)&ext->parsed;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_USES;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&ext->parsed;
+    ext->substmts[2].storage_p = (void **)&ext->parsed;
 
     if ((ret = lyplg_ext_parse_extension_instance(pctx, ext))) {
         return ret;
@@ -96,15 +96,15 @@
     LY_ARRAY_CREATE_GOTO(cctx->ctx, ext->substmts, 3, ret, emem);
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_CONTAINER;
-    ext->substmts[0].storage = (uint64_t)(uintptr_t)&ext->compiled;
+    ext->substmts[0].storage_p = (void **)&ext->compiled;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_CHOICE;
-    ext->substmts[1].storage = (uint64_t)(uintptr_t)&ext->compiled;
+    ext->substmts[1].storage_p = (void **)&ext->compiled;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_USES;
-    ext->substmts[2].storage = (uint64_t)(uintptr_t)&ext->compiled;
+    ext->substmts[2].storage_p = (void **)&ext->compiled;
 
     *lyplg_ext_compile_get_options(cctx) |= LYS_COMPILE_NO_CONFIG | LYS_COMPILE_NO_DISABLED;
     ret = lyplg_ext_compile_extension_instance(cctx, extp, ext);
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 67c94d9..3adcc2a 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -2563,7 +2563,7 @@
                 break;
             }
 
-            LY_LIST_FOR(*VOIDPTR2_C(ext->substmts[u].storage), node) {
+            LY_LIST_FOR(*ext->substmts[u].storage_p, node) {
                 ypr_open(pctx->out, flag);
                 if (ext->substmts[u].stmt == LY_STMT_NOTIFICATION) {
                     yprc_notification(pctx, (struct lysc_node_notif *)node);
@@ -2592,32 +2592,32 @@
         case LY_STMT_PRESENCE:
         case LY_STMT_REFERENCE:
         case LY_STMT_UNITS:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
+            if (*ext->substmts[u].storage_p) {
                 ypr_open(pctx->out, flag);
-                ypr_substmt(pctx, ext->substmts[u].stmt, 0, *VOIDPTR2_C(ext->substmts[u].storage), 0, ext->exts);
+                ypr_substmt(pctx, ext->substmts[u].stmt, 0, *ext->substmts[u].storage_p, 0, ext->exts);
             }
             break;
         case LY_STMT_BIT:
         case LY_STMT_ENUM: {
-            const struct lysc_type_bitenum_item *items = *VOIDPTR2_C(ext->substmts[u].storage);
+            const struct lysc_type_bitenum_item *items = *ext->substmts[u].storage_p;
 
             yprc_bits_enum(pctx, items, ext->substmts[u].stmt == LY_STMT_BIT ? LY_TYPE_BITS : LY_TYPE_ENUM, flag);
             break;
         }
         case LY_STMT_CONFIG:
-            ypr_config(pctx, *(uint16_t *)VOIDPTR2_C(ext->substmts[u].storage), ext->exts, flag);
+            ypr_config(pctx, *(uint16_t *)ext->substmts[u].storage_p, ext->exts, flag);
             break;
         case LY_STMT_EXTENSION_INSTANCE:
-            yprc_extension_instances(pctx, LY_STMT_EXTENSION_INSTANCE, 0, *VOIDPTR2_C(ext->substmts[u].storage), flag);
+            yprc_extension_instances(pctx, LY_STMT_EXTENSION_INSTANCE, 0, *ext->substmts[u].storage_p, flag);
             break;
         case LY_STMT_FRACTION_DIGITS:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
+            if (*ext->substmts[u].storage_p) {
                 ypr_unsigned(pctx, LY_STMT_FRACTION_DIGITS, 0, ext->exts,
-                        (long unsigned int)*VOIDPTR2_C(ext->substmts[u].storage), flag);
+                        (long unsigned int)*ext->substmts[u].storage_p, flag);
             }
             break;
         case LY_STMT_IDENTITY: {
-            const struct lysc_ident *idents = *VOIDPTR2_C(ext->substmts[u].storage);
+            const struct lysc_ident *idents = *ext->substmts[u].storage_p;
 
             LY_ARRAY_FOR(idents, v) {
                 yprc_identity(pctx, &idents[v]);
@@ -2625,15 +2625,15 @@
             break;
         }
         case LY_STMT_LENGTH:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
-                yprc_range(pctx, *VOIDPTR2_C(ext->substmts[u].storage), LY_TYPE_STRING, flag);
+            if (*ext->substmts[u].storage_p) {
+                yprc_range(pctx, *ext->substmts[u].storage_p, LY_TYPE_STRING, flag);
             }
             break;
         case LY_STMT_MANDATORY:
-            ypr_mandatory(pctx, *(uint16_t *)VOIDPTR_C(ext->substmts[u].storage), ext->exts, flag);
+            ypr_mandatory(pctx, *(uint16_t *)ext->substmts[u].storage_p, ext->exts, flag);
             break;
         case LY_STMT_MAX_ELEMENTS: {
-            uint32_t max = *(uint32_t *)VOIDPTR_C(ext->substmts[u].storage);
+            uint32_t max = *(uint32_t *)ext->substmts[u].storage_p;
 
             if (max) {
                 ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, ext->exts, max, flag);
@@ -2644,15 +2644,15 @@
             break;
         }
         case LY_STMT_MIN_ELEMENTS:
-            ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, ext->exts, *(uint32_t *)VOIDPTR_C(ext->substmts[u].storage), flag);
+            ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, ext->exts, *(uint32_t *)ext->substmts[u].storage_p, flag);
             break;
         case LY_STMT_ORDERED_BY:
             ypr_open(pctx->out, flag);
             ypr_substmt(pctx, LY_STMT_ORDERED_BY, 0,
-                    ((*(uint16_t *)VOIDPTR_C(ext->substmts[u].storage)) & LYS_ORDBY_USER) ? "user" : "system", 0, ext->exts);
+                    ((*(uint16_t *)ext->substmts[u].storage_p) & LYS_ORDBY_USER) ? "user" : "system", 0, ext->exts);
             break;
         case LY_STMT_MUST: {
-            const struct lysc_must *musts = *VOIDPTR2_C(ext->substmts[u].storage);
+            const struct lysc_must *musts = *ext->substmts[u].storage_p;
 
             LY_ARRAY_FOR(musts, v) {
                 yprc_must(pctx, &musts[v], flag);
@@ -2660,7 +2660,7 @@
             break;
         }
         case LY_STMT_PATTERN: {
-            const struct lysc_pattern *patterns = *VOIDPTR2_C(ext->substmts[u].storage);
+            const struct lysc_pattern *patterns = *ext->substmts[u].storage_p;
 
             LY_ARRAY_FOR(patterns, v) {
                 yprc_pattern(pctx, &patterns[v], flag);
@@ -2668,36 +2668,36 @@
             break;
         }
         case LY_STMT_POSITION:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
-                ypr_unsigned(pctx, ext->substmts[u].stmt, 0, ext->exts, *(int64_t *)VOIDPTR_C(ext->substmts[u].storage), flag);
+            if (*ext->substmts[u].storage_p) {
+                ypr_unsigned(pctx, ext->substmts[u].stmt, 0, ext->exts, *(int64_t *)ext->substmts[u].storage_p, flag);
             }
             break;
         case LY_STMT_VALUE:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
-                ypr_signed(pctx, ext->substmts[u].stmt, 0, ext->exts, *(int64_t *)VOIDPTR_C(ext->substmts[u].storage), flag);
+            if (*ext->substmts[u].storage_p) {
+                ypr_signed(pctx, ext->substmts[u].stmt, 0, ext->exts, *(int64_t *)ext->substmts[u].storage_p, flag);
             }
             break;
         case LY_STMT_RANGE:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
-                yprc_range(pctx, *VOIDPTR2_C(ext->substmts[u].storage), LY_TYPE_UINT64, flag);
+            if (*ext->substmts[u].storage_p) {
+                yprc_range(pctx, *ext->substmts[u].storage_p, LY_TYPE_UINT64, flag);
             }
             break;
         case LY_STMT_REQUIRE_INSTANCE:
             ypr_open(pctx->out, flag);
-            ypr_substmt(pctx, LY_STMT_REQUIRE_INSTANCE, 0, *(uint8_t *)VOIDPTR_C(ext->substmts[u].storage) ? "true" : "false",
+            ypr_substmt(pctx, LY_STMT_REQUIRE_INSTANCE, 0, *(uint8_t *)ext->substmts[u].storage_p ? "true" : "false",
                     0, ext->exts);
             break;
         case LY_STMT_STATUS:
-            ypr_status(pctx, *(uint16_t *)VOIDPTR_C(ext->substmts[u].storage), ext->exts, flag);
+            ypr_status(pctx, *(uint16_t *)ext->substmts[u].storage_p, ext->exts, flag);
             break;
         case LY_STMT_TYPE:
-            if (*VOIDPTR2_C(ext->substmts[u].storage)) {
+            if (*ext->substmts[u].storage_p) {
                 ypr_open(pctx->out, flag);
-                yprc_type(pctx, *VOIDPTR2_C(ext->substmts[u].storage));
+                yprc_type(pctx, *ext->substmts[u].storage_p);
             }
             break;
         case LY_STMT_WHEN:
-            yprc_when(pctx, *VOIDPTR2_C(ext->substmts[u].storage), flag);
+            yprc_when(pctx, *ext->substmts[u].storage_p, flag);
             break;
         case LY_STMT_AUGMENT:
         case LY_STMT_BASE:
diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c
index 4eac4ec..21cb632 100644
--- a/src/schema_compile_amend.c
+++ b/src/schema_compile_amend.c
@@ -2218,7 +2218,7 @@
         aug_p = NULL;
         LY_ARRAY_FOR(pmod->exts[u].substmts, v) {
             if (pmod->exts[u].substmts[v].stmt == LY_STMT_AUGMENT) {
-                aug_p = *VOIDPTR2_C(pmod->exts[u].substmts[v].storage);
+                aug_p = *(pmod->exts[u].substmts[v].storage_p);
                 break;
             }
         }
@@ -2488,7 +2488,7 @@
         aug = NULL;
         LY_ARRAY_FOR(pmod->exts[u].substmts, v) {
             if (pmod->exts[u].substmts[v].stmt == LY_STMT_AUGMENT) {
-                aug = *VOIDPTR2_C(pmod->exts[u].substmts[v].storage);
+                aug = *(pmod->exts[u].substmts[v].storage_p);
                 break;
             }
         }
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 5d2f0ae..46ae393 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -2585,7 +2585,7 @@
         struct lysc_node **list = NULL;
 
         if (ctx->ext) {
-            lyplg_ext_get_storage_p(ctx->ext, LY_STMT_DATA_NODE_MASK, (uint64_t *)&list);
+            lyplg_ext_get_storage_p(ctx->ext, LY_STMT_DATA_NODE_MASK, (void ***)&list);
         } else if (node->nodetype == LYS_RPC) {
             list = (struct lysc_node **)&ctx->cur_mod->compiled->rpcs;
         } else if (node->nodetype == LYS_NOTIF) {
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index ee05d3c..040872b 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -1362,7 +1362,7 @@
     ly_bool node_free;
 
     LY_ARRAY_FOR(substmts, u) {
-        if (!substmts[u].storage) {
+        if (!substmts[u].storage_p) {
             continue;
         }
 
@@ -1385,75 +1385,75 @@
         case LY_STMT_USES: {
             struct lysp_node *child, *child_next;
 
-            LY_LIST_FOR_SAFE(*VOIDPTR2_C(substmts[u].storage), child_next, child) {
+            LY_LIST_FOR_SAFE(*substmts[u].storage_p, child_next, child) {
                 node_free = (child->nodetype & (LYS_INPUT | LYS_OUTPUT)) ? 1 : 0;
                 lysp_node_free(&fctx, child);
                 if (node_free) {
                     free(child);
                 }
             }
-            *VOIDPTR2_C(substmts[u].storage) = NULL;
+            *substmts[u].storage_p = NULL;
             break;
         }
         case LY_STMT_BASE:
             /* multiple strings */
-            FREE_ARRAY(ctx, **(const char ***)VOIDPTR2_C(substmts[u].storage), lydict_remove);
+            FREE_ARRAY(ctx, **(const char ***)substmts[u].storage_p, lydict_remove);
             break;
 
         case LY_STMT_BIT:
         case LY_STMT_ENUM:
             /* single enum */
-            lysp_type_enum_free(&fctx, *VOIDPTR2_C(substmts[u].storage));
+            lysp_type_enum_free(&fctx, *substmts[u].storage_p);
             break;
 
         case LY_STMT_DEVIATE:
             /* single deviate */
-            lysp_deviate_free(&fctx, *VOIDPTR2_C(substmts[u].storage));
+            lysp_deviate_free(&fctx, *substmts[u].storage_p);
             break;
 
         case LY_STMT_DEVIATION:
             /* single deviation */
-            lysp_deviation_free(&fctx, *VOIDPTR2_C(substmts[u].storage));
+            lysp_deviation_free(&fctx, *substmts[u].storage_p);
             break;
 
         case LY_STMT_EXTENSION:
             /* single extension */
-            lysp_ext_free(&fctx, *VOIDPTR2_C(substmts[u].storage));
+            lysp_ext_free(&fctx, *substmts[u].storage_p);
             break;
 
         case LY_STMT_EXTENSION_INSTANCE:
             /* multiple extension instances */
-            FREE_ARRAY(&fctx, *(struct lysp_ext_instance **)VOIDPTR2_C(substmts[u].storage), lysp_ext_instance_free);
+            FREE_ARRAY(&fctx, *(struct lysp_ext_instance **)substmts[u].storage_p, lysp_ext_instance_free);
             break;
 
         case LY_STMT_FEATURE:
             /* multiple features */
-            FREE_ARRAY(&fctx, *(struct lysp_feature **)VOIDPTR2_C(substmts[u].storage), lysp_feature_free);
+            FREE_ARRAY(&fctx, *(struct lysp_feature **)substmts[u].storage_p, lysp_feature_free);
             break;
 
         case LY_STMT_IDENTITY:
             /* multiple identities */
-            FREE_ARRAY(&fctx, *(struct lysp_ident **)VOIDPTR2_C(substmts[u].storage), lysp_ident_free);
+            FREE_ARRAY(&fctx, *(struct lysp_ident **)substmts[u].storage_p, lysp_ident_free);
             break;
 
         case LY_STMT_IMPORT:
             /* multiple imports */
-            FREE_ARRAY(&fctx, *(struct lysp_import **)VOIDPTR2_C(substmts[u].storage), lysp_import_free);
+            FREE_ARRAY(&fctx, *(struct lysp_import **)substmts[u].storage_p, lysp_import_free);
             break;
 
         case LY_STMT_INCLUDE:
             /* multiple includes */
-            FREE_ARRAY(&fctx, *(struct lysp_include **)VOIDPTR2_C(substmts[u].storage), lysp_include_free);
+            FREE_ARRAY(&fctx, *(struct lysp_include **)substmts[u].storage_p, lysp_include_free);
             break;
 
         case LY_STMT_REFINE:
             /* multiple refines */
-            FREE_ARRAY(&fctx, *(struct lysp_refine **)VOIDPTR2_C(substmts[u].storage), lysp_refine_free);
+            FREE_ARRAY(&fctx, *(struct lysp_refine **)substmts[u].storage_p, lysp_refine_free);
             break;
 
         case LY_STMT_REVISION:
             /* multiple revisions */
-            FREE_ARRAY(&fctx, *(struct lysp_revision **)VOIDPTR2_C(substmts[u].storage), lysp_revision_free);
+            FREE_ARRAY(&fctx, *(struct lysp_revision **)substmts[u].storage_p, lysp_revision_free);
             break;
 
         case LY_STMT_CONFIG:
@@ -1487,7 +1487,7 @@
         case LY_STMT_REVISION_DATE:
         case LY_STMT_UNITS:
             /* single string */
-            lydict_remove(ctx, *VOIDPTR2_C(substmts[u].storage));
+            lydict_remove(ctx, *substmts[u].storage_p);
             break;
 
         case LY_STMT_LENGTH:
@@ -1495,34 +1495,34 @@
         case LY_STMT_PATTERN:
         case LY_STMT_RANGE:
             /* multiple restrictions */
-            FREE_ARRAY(&fctx, *(struct lysp_restr **)VOIDPTR2_C(substmts[u].storage), lysp_restr_free);
+            FREE_ARRAY(&fctx, *(struct lysp_restr **)substmts[u].storage_p, lysp_restr_free);
             break;
 
         case LY_STMT_WHEN:
             /* multiple whens */
-            FREE_ARRAY(&fctx, *(struct lysp_when **)VOIDPTR2_C(substmts[u].storage), lysp_when_free);
+            FREE_ARRAY(&fctx, *(struct lysp_when **)substmts[u].storage_p, lysp_when_free);
             break;
 
         case LY_STMT_PATH:
             /* single expression */
-            lyxp_expr_free(ctx, *VOIDPTR2_C(substmts[u].storage));
+            lyxp_expr_free(ctx, *substmts[u].storage_p);
             break;
 
         case LY_STMT_DEFAULT:
         case LY_STMT_IF_FEATURE:
         case LY_STMT_UNIQUE:
             /* multiple qnames */
-            FREE_ARRAY(ctx, *(struct lysp_qname **)VOIDPTR2_C(substmts[u].storage), lysp_qname_free);
+            FREE_ARRAY(ctx, *(struct lysp_qname **)substmts[u].storage_p, lysp_qname_free);
             break;
 
         case LY_STMT_TYPEDEF:
             /* multiple typedefs */
-            FREE_ARRAY(&fctx, *(struct lysp_tpdf **)VOIDPTR2_C(substmts[u].storage), lysp_tpdf_free);
+            FREE_ARRAY(&fctx, *(struct lysp_tpdf **)substmts[u].storage_p, lysp_tpdf_free);
             break;
 
         case LY_STMT_TYPE: {
             /* single type */
-            struct lysp_type **type_p = VOIDPTR_C(substmts[u].storage);
+            struct lysp_type **type_p = (struct lysp_type **)substmts[u].storage_p;
 
             lysp_type_free(&fctx, *type_p);
             free(*type_p);
@@ -1531,7 +1531,7 @@
         case LY_STMT_MODULE:
         case LY_STMT_SUBMODULE:
             /* single (sub)module */
-            lysp_module_free(&fctx, *VOIDPTR2_C(substmts[u].storage));
+            lysp_module_free(&fctx, *substmts[u].storage_p);
             break;
 
         default:
@@ -1550,7 +1550,7 @@
     ly_bool node_free;
 
     LY_ARRAY_FOR(substmts, u) {
-        if (!substmts[u].storage) {
+        if (!substmts[u].storage_p) {
             continue;
         }
 
@@ -1570,14 +1570,14 @@
         case LY_STMT_LIST: {
             struct lysc_node *child, *child_next;
 
-            LY_LIST_FOR_SAFE(*VOIDPTR2_C(substmts[u].storage), child_next, child) {
+            LY_LIST_FOR_SAFE(*substmts[u].storage_p, child_next, child) {
                 node_free = (child->nodetype & (LYS_INPUT | LYS_OUTPUT)) ? 1 : 0;
                 lysc_node_free_(&fctx, child);
                 if (node_free) {
                     free(child);
                 }
             }
-            *VOIDPTR2_C(substmts[u].storage) = NULL;
+            *substmts[u].storage_p = NULL;
             break;
         }
         case LY_STMT_USES:
@@ -1607,7 +1607,7 @@
         case LY_STMT_REFERENCE:
         case LY_STMT_UNITS: {
             /* single item */
-            const char *str = *VOIDPTR2_C(substmts[u].storage);
+            const char *str = *substmts[u].storage_p;
 
             lydict_remove(ctx, str);
             break;
@@ -1615,7 +1615,7 @@
         case LY_STMT_BIT:
         case LY_STMT_ENUM: {
             /* sized array */
-            struct lysc_type_bitenum_item *items = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_type_bitenum_item *items = *substmts[u].storage_p;
 
             FREE_ARRAY(&fctx, items, lysc_enum_item_free);
             break;
@@ -1623,47 +1623,47 @@
         case LY_STMT_LENGTH:
         case LY_STMT_RANGE: {
             /* single item */
-            struct lysc_range *range = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_range *range = *substmts[u].storage_p;
 
             lysc_range_free(&fctx, range);
             break;
         }
         case LY_STMT_MUST: {
             /* sized array */
-            struct lysc_must *musts = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_must *musts = *substmts[u].storage_p;
 
             FREE_ARRAY(&fctx, musts, lysc_must_free);
             break;
         }
         case LY_STMT_WHEN:
             /* single item, expects a pointer */
-            lysc_when_free(&fctx, VOIDPTR_C(substmts[u].storage));
+            lysc_when_free(&fctx, (struct lysc_when **)substmts[u].storage_p);
             break;
 
         case LY_STMT_PATTERN: {
             /* sized array of pointers */
-            struct lysc_pattern **patterns = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_pattern **patterns = *substmts[u].storage_p;
 
             FREE_ARRAY(&fctx, patterns, lysc_pattern_free);
             break;
         }
         case LY_STMT_TYPE: {
             /* single item */
-            struct lysc_type *type = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_type *type = *substmts[u].storage_p;
 
             lysc_type_free(&fctx, type);
             break;
         }
         case LY_STMT_IDENTITY: {
             /* sized array */
-            struct lysc_ident *idents = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_ident *idents = *substmts[u].storage_p;
 
             FREE_ARRAY(&fctx, idents, lysc_ident_free);
             break;
         }
         case LY_STMT_EXTENSION_INSTANCE: {
             /* sized array */
-            struct lysc_ext_instance *exts = *VOIDPTR2_C(substmts[u].storage);
+            struct lysc_ext_instance *exts = *substmts[u].storage_p;
 
             FREE_ARRAY(&fctx, exts, lysc_ext_instance_free);
             break;
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index d3e399c..ee40f58 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -726,11 +726,11 @@
  * @param[in] ext Compiled ext instance.
  * @param[in] stmt Compiled statement. Can be a mask when the first match is returned, it is expected the storage is
  * the same for all the masked statements.
- * @param[out] storage_p Pointer to a compiled ext instance substatement storage, NULL if was not compiled.
+ * @param[out] storage_pp Pointer to a compiled ext instance substatement storage, NULL if was not compiled.
  * @return LY_SUCCESS on success.
  * @return LY_ENOT if the substatement is not supported.
  */
-LY_ERR lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, uint64_t *storage_p);
+LY_ERR lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, void ***storage_pp);
 
 /**
  * @brief Warning if the filename does not match the expected module name and version
diff --git a/tests/utests/basic/test_context.c b/tests/utests/basic/test_context.c
index 7feb65f..476fd81 100644
--- a/tests/utests/basic/test_context.c
+++ b/tests/utests/basic/test_context.c
@@ -831,8 +831,8 @@
     LY_ARRAY_FOR(ext, u) {
         substmts = ext[u].substmts;
         LY_ARRAY_FOR(substmts, v) {
-            if (substmts && substmts[v].storage && (substmts[v].stmt & LY_STMT_DATA_NODE_MASK)) {
-                cnode = *(struct lysc_node **)substmts[v].storage;
+            if (substmts && substmts[v].storage_p && (substmts[v].stmt & LY_STMT_DATA_NODE_MASK)) {
+                cnode = *(struct lysc_node **)substmts[v].storage_p;
                 iter = check;
                 assert_int_equal(LY_SUCCESS, lysc_tree_dfs_full(cnode, check_node_priv_parsed_is_set, &iter));
             }
@@ -850,8 +850,8 @@
     LY_ARRAY_FOR(ext, u) {
         substmts = ext[u].substmts;
         LY_ARRAY_FOR(substmts, v) {
-            if (substmts && substmts[v].storage && (substmts[v].stmt & LY_STMT_DATA_NODE_MASK)) {
-                cnode = *(struct lysc_node **)substmts[v].storage;
+            if (substmts && substmts[v].storage_p && (substmts[v].stmt & LY_STMT_DATA_NODE_MASK)) {
+                cnode = *(struct lysc_node **)substmts[v].storage_p;
                 if (cnode) {
                     CHECK_POINTER((struct lysp_node *)cnode->priv, 0);
                 }
diff --git a/tests/utests/schema/test_schema.c b/tests/utests/schema/test_schema.c
index 953aad8..cba2b2d 100644
--- a/tests/utests/schema/test_schema.c
+++ b/tests/utests/schema/test_schema.c
@@ -1712,7 +1712,7 @@
     LY_ARRAY_NEW_GOTO(UTEST_LYCTX, ext_p.substmts, substmtp, rc, cleanup);
 
     substmtp->stmt = LY_STMT_ERROR_MESSAGE;
-    substmtp->storage = (uintptr_t)(void *)&ext_p.parsed;
+    substmtp->storage_p = &ext_p.parsed;
     /* fake parse */
     lydict_insert(UTEST_LYCTX, "my error", 0, (const char **)&ext_p.parsed);
 
@@ -1721,7 +1721,7 @@
     LY_ARRAY_NEW_GOTO(UTEST_LYCTX, ext_c.substmts, substmt, rc, cleanup);
 
     substmt->stmt = LY_STMT_ERROR_MESSAGE;
-    substmt->storage = (uintptr_t)(void *)&ext_c.compiled;
+    substmt->storage_p = &ext_c.compiled;
 
     /*
      * error-message