Skip to content

Commit a258faf

Browse files
committed
use schema path if no parent
1 parent bee4a8b commit a258faf

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/validation.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,24 +1185,19 @@ lyd_validate_minmax(const struct lyd_node *first, const struct lyd_node *parent,
11851185
}
11861186

11871187
if (min || max) {
1188-
11891188
if (min) {
1190-
char suffix_path[256];
1191-
1192-
if (parent == NULL) {
1193-
/* Real world this shouldn't happen, but test cases there may be no parent */
1194-
snprintf(suffix_path, sizeof(suffix_path), "/%s:%s", snode->module->name, snode->name);
1195-
} else {
1189+
char suffix_path[256] = "";
1190+
if (parent != NULL) {
11961191
snprintf(suffix_path, sizeof(suffix_path), "/%s", snode->name);
11971192
}
11981193

1199-
ly_log_location(NULL, parent, suffix_path, NULL);
1194+
ly_log_location((!parent)?snode:NULL, parent, parent?suffix_path:NULL, NULL);
12001195
if (val_opts & LYD_VALIDATE_OPERATIONAL) {
12011196
LOGWRN(snode->module->ctx, "Too few \"%s\" instances.", snode->name);
12021197
} else {
12031198
LOGVAL_APPTAG(snode->module->ctx, "too-few-elements", LY_VCODE_NOMIN, snode->name);
12041199
}
1205-
ly_log_location_revert(0, 1, 1, 0);
1200+
ly_log_location_revert((!parent)?1:0, parent?1:0, parent?1:0, 0);
12061201
} else {
12071202
ly_log_location(NULL, iter, NULL, NULL);
12081203
if (val_opts & LYD_VALIDATE_OPERATIONAL) {

0 commit comments

Comments
 (0)