schema tree FEATURE store augmented_by modules
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 0367b27..8b7f7b2 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -1653,6 +1653,7 @@
struct lysc_notif *notifs; /**< list of notifications ([sized array](@ref sizedarrays)) */
struct lysc_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
struct lys_module **deviated_by; /**< List of modules that deviate this module ([sized array](@ref sizedarrays)) */
+ struct lys_module **augmented_by;/**< List of modules that augment this module ([sized array](@ref sizedarrays)) */
};
/**
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 1cfba45..c5e56a5 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -4354,6 +4354,7 @@
struct lysc_node *target; /* target target of the augment */
struct lysc_node *node;
struct lysc_when **when, *when_shared;
+ struct lys_module **aug_mod;
int allow_mandatory = 0;
uint16_t flags = 0;
unsigned int u;
@@ -4487,8 +4488,13 @@
}
}
+ /* add this module into the target module augmented_by */
+ LY_ARRAY_NEW_GOTO(ctx->ctx, target->module->compiled->augmented_by, aug_mod, ret, error);
+ *aug_mod = ctx->mod;
+
lysc_update_path(ctx, NULL, NULL);
lysc_update_path(ctx, NULL, NULL);
+
error:
ctx->options = opt_prev;
return ret;
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 60d91e8..f13dd1b 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -849,6 +849,7 @@
FREE_ARRAY(ctx, module->notifs, lysc_notif_free);
FREE_ARRAY(ctx, module->exts, lysc_ext_instance_free);
LY_ARRAY_FREE(module->deviated_by);
+ LY_ARRAY_FREE(module->augmented_by);
free(module);
}