data tree OPTIMIZE minor optimization
diff --git a/src/tree_data.c b/src/tree_data.c
index 3e4d8b5..1230f8d 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2344,7 +2344,8 @@
} else {
/* find the anchor without hashes */
match = (struct lyd_node *)first_sibling;
- if (!lysc_data_parent(new_node->schema)) {
+ sparent = lysc_data_parent(new_node->schema);
+ if (!sparent) {
/* we are in top-level, skip all the data from preceding modules */
LY_LIST_FOR(match, match) {
if (!match->schema || (strcmp(lyd_owner_module(match)->name, lyd_owner_module(new_node)->name) >= 0)) {
@@ -2354,7 +2355,6 @@
}
/* get the first schema sibling */
- sparent = lysc_data_parent(new_node->schema);
schema = lys_getnext(NULL, sparent, new_node->schema->module->compiled, getnext_opts);
found = 0;