extensions CHANGE extension instance structures optimization
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 55f0cdd..8a40588 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1117,6 +1117,8 @@
 
     (*new) = result = calloc(size, sizeof *result);
     for (u = 0; u < size; u++) {
+        /* TODO cover complex extension instances */
+
         if (orig[u]) {
             /* resolved extension instance, just duplicate it */
             switch(lys_ext_instance_type(orig[u])) {
@@ -1125,6 +1127,7 @@
                 break;
             case LYEXT_COMPLEX:
                 result[u] = calloc(1, ((struct lyext_plugin_complex*)orig[u]->def->plugin)->instance_size);
+                ((struct lys_ext_instance_complex*)result[u])->module = mod;
                 /* TODO duplicate data in extension instance content */
                 break;
             case LYEXT_ERR:
@@ -1136,7 +1139,6 @@
             result[u]->flags = 0;
             result[u]->arg_value = lydict_insert(mod->ctx, orig[u]->arg_value, 0);
             result[u]->parent = parent;
-            result[u]->module = mod;
             result[u]->parent_type = parent_type;
             result[u]->substmt = orig[u]->substmt;
             result[u]->substmt_index = orig[u]->substmt_index;
@@ -1427,7 +1429,6 @@
     }
 
     switch (ext->substmt) {
-    case LYEXT_SUBSTMT_ALL:
     case LYEXT_SUBSTMT_SELF:
     case LYEXT_SUBSTMT_MODIFIER:
     case LYEXT_SUBSTMT_VERSION: