extension instances CHANGE access to the extension instance's substatements

Provide libyang a transparent access to the substatements of a specific
extension instances for various generic processing.

The patch introduces lysc_ext_substmt() to simplify work with the newly
added lysc_ext_instance.substmts sized array providing the extension
instance's substatements.
diff --git a/src/validation.c b/src/validation.c
index dcf37a9..e122049 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -27,6 +27,7 @@
 #include "hash_table.h"
 #include "log.h"
 #include "parser_data.h"
+#include "plugins_exts.h"
 #include "plugins_exts_metadata.h"
 #include "plugins_types.h"
 #include "set.h"
@@ -269,7 +270,7 @@
             --i;
 
             struct lyd_meta *meta = meta_types->objs[i];
-            struct lysc_type *type = ((struct lyext_metadata *)meta->annotation->data)->type;
+            struct lysc_type *type = *(struct lysc_type **)meta->annotation->substmts[ANNOTATION_SUBSTMT_TYPE].storage;
 
             /* validate and store the value of the metadata */
             ret = lyd_value_validate_incomplete(LYD_CTX(meta->parent), type, &meta->value, meta->parent, *tree);
@@ -1322,7 +1323,7 @@
 
     LYD_TREE_DFS_BEGIN(root, node) {
         LY_LIST_FOR(node->meta, meta) {
-            if (((struct lyext_metadata *)meta->annotation->data)->type->plugin->validate) {
+            if ((*(const struct lysc_type **)meta->annotation->substmts[ANNOTATION_SUBSTMT_TYPE].storage)->plugin->validate) {
                 /* metadata type resolution */
                 LY_CHECK_RET(ly_set_add(meta_types, (void *)meta, 1, NULL));
             }