schema tree BUGFIX make sure features are correctly set
... when using ly_ctx_load_module and the module is
already loaded and implemented.
#include "in_internal.h"
#include "log.h"
#include "parser_schema.h"
+#include "schema_features.h"
+#include "schema_compile.h"
#include "set.h"
#include "tree.h"
#include "tree_data.h"
@@ -874,13 +876,26 @@ search_file:
/*
* module found, make sure it is implemented if should be
*/
- if (implement && !(*mod)->implemented) {
+ if (implement) {
+ if ((*mod)->implemented) {
+ /* set features if different */
+ ret = lys_set_features((*mod)->parsed, features);
+ if (!ret) {
+ /* context need to be recompiled so that feature changes are properly applied */
+ unres->recompile = 1;
+ } else if (ret != LY_EEXIST) {
+ /* error */
+ return ret;
+ } /* else no feature changes */
+ } else {
+ /* implement */
ret = lys_set_implemented_r(*mod, features, unres);
if (ret) {
*mod = NULL;
return ret;
}
}
+ }
return LY_SUCCESS;
}
