schema compile FEATURE support for glob unres reset
That preserves creating and implementing module sets.
diff --git a/src/context.c b/src/context.c
index 89cb767..2296090 100644
--- a/src/context.c
+++ b/src/context.c
@@ -20,6 +20,7 @@
#include "context.h"
+#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <stdarg.h>
@@ -205,10 +206,10 @@
cleanup:
if (ret) {
lys_compile_unres_glob_revert(ctx, &unres);
- result = NULL;
+ mod = NULL;
}
- lys_compile_unres_glob_erase(ctx, &unres);
- return result;
+ lys_compile_unres_glob_erase(ctx, &unres, 0);
+ return mod;
}
API LY_ERR
@@ -298,14 +299,12 @@
}
ly_in_free(in, 0);
- lys_compile_unres_glob_erase(ctx, &unres);
- *new_ctx = ctx;
- return rc;
-
-error:
- ly_in_free(in, 0);
- lys_compile_unres_glob_erase(ctx, &unres);
- ly_ctx_destroy(ctx);
+ lys_compile_unres_glob_erase(ctx, &unres, 0);
+ if (rc) {
+ ly_ctx_destroy(ctx);
+ } else {
+ *new_ctx = ctx;
+ }
return rc;
}