schema tree REFACTOR formatting
diff --git a/src/set.h b/src/set.h
index 9ed2b05..9312af8 100644
--- a/src/set.h
+++ b/src/set.h
@@ -43,8 +43,7 @@
* To free the structure, use ::ly_set_free() function, to manipulate with the structure, use other
* ly_set_* functions.
*/
-struct ly_set
-{
+struct ly_set {
uint32_t size; /**< allocated size of the set array */
uint32_t count; /**< number of elements in (used size of) the set array */
union {
diff --git a/src/tree_schema.c b/src/tree_schema.c
index d2ed415..cde2fa2 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1467,11 +1467,10 @@
cleanup:
if (ret) {
lys_compile_unres_glob_revert(ctx, &unres);
+ } else if (module) {
+ *module = mod;
}
lys_compile_unres_glob_erase(ctx, &unres);
- if (ret && module) {
- *module = NULL;
- }
return ret;
}
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 704095f..09deb7a 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -647,8 +647,8 @@
LY_ERR ret = LY_SUCCESS;
struct lysp_load_module_check_data check_data = {0};
- LY_CHECK_RET(lys_search_localfile(ly_ctx_get_searchdirs(ctx), !(ctx->flags & LY_CTX_DISABLE_SEARCHDIR_CWD), name, revision,
- &filepath, &format));
+ LY_CHECK_RET(lys_search_localfile(ly_ctx_get_searchdirs(ctx), !(ctx->flags & LY_CTX_DISABLE_SEARCHDIR_CWD), name,
+ revision, &filepath, &format));
if (!filepath) {
if (required) {
LOGERR(ctx, LY_ENOTFOUND, "Data model \"%s%s%s\" not found in local searchdirs.", name, revision ? "@" : "",
@@ -731,17 +731,15 @@
/* module not present in the context, get the input data and parse it */
if (!(ctx->flags & LY_CTX_PREFER_SEARCHDIRS)) {
search_clb:
- if (ctx->imp_clb) {
- if (ctx->imp_clb(name, revision, NULL, NULL, ctx->imp_clb_data,
- &format, &module_data, &module_data_free) == LY_SUCCESS) {
- LY_CHECK_RET(ly_in_new_memory(module_data, &in));
- check_data.name = name;
- check_data.revision = revision;
- lys_create_module(ctx, in, format, implement, lysp_load_module_check, &check_data, features, unres, mod);
- ly_in_free(in, 0);
- if (module_data_free) {
- module_data_free((void *)module_data, ctx->imp_clb_data);
- }
+ if (ctx->imp_clb && !ctx->imp_clb(name, revision, NULL, NULL, ctx->imp_clb_data, &format, &module_data,
+ &module_data_free)) {
+ LY_CHECK_RET(ly_in_new_memory(module_data, &in));
+ check_data.name = name;
+ check_data.revision = revision;
+ lys_parse_in(ctx, in, format, lysp_load_module_check, &check_data, unres, mod);
+ ly_in_free(in, 0);
+ if (module_data_free) {
+ module_data_free((void *)module_data, ctx->imp_clb_data);
}
}
if (!(*mod) && !(ctx->flags & LY_CTX_PREFER_SEARCHDIRS)) {
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index f6e1bae..9501ee8 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -566,9 +566,8 @@
* @param[out] submodule Parsed submodule.
* @return LY_ERR value.
*/
-LY_ERR lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format,
- struct lys_parser_ctx *main_ctx, lys_custom_check custom_check,
- void *check_data, struct lysp_submodule **submodule);
+LY_ERR lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, struct lys_parser_ctx *main_ctx,
+ lys_custom_check custom_check, void *check_data, struct lysp_submodule **submodule);
/**
* @brief Fill filepath value if available in input handler @p in