1
0
Fork 0

Merging upstream version 3.12.2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-02 04:14:45 +02:00
parent 6375ddbe5b
commit 580fa3f55c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
66 changed files with 4041 additions and 2142 deletions

View file

@ -29,6 +29,7 @@
#include "cmd.h"
#include "common.h"
#include "compat.h"
#include "out.h"
#include "tools/config.h"
#include "yl_opt.h"
@ -228,7 +229,8 @@ help(int shortout)
static void
libyang_verbclb(LY_LOG_LEVEL level, const char *msg, const char *data_path, const char *schema_path, uint64_t line)
{
char *levstr;
const char *levstr;
char *full_msg = NULL, *aux;
switch (level) {
case LY_LLERR:
@ -244,15 +246,34 @@ libyang_verbclb(LY_LOG_LEVEL level, const char *msg, const char *data_path, cons
levstr = "dbg :";
break;
}
if (data_path) {
fprintf(stderr, "libyang %s %s (%s)\n", levstr, msg, data_path);
} else if (schema_path) {
fprintf(stderr, "libyang %s %s (%s)\n", levstr, msg, schema_path);
} else if (line) {
fprintf(stderr, "libyang %s %s (line %" PRIu64 ")\n", levstr, msg, line);
} else {
fprintf(stderr, "libyang %s %s\n", levstr, msg);
if (asprintf(&full_msg, "libyang %s %s", levstr, msg) == -1) {
goto error;
}
if (data_path || schema_path) {
if (asprintf(&aux, "%s (%s)", full_msg, data_path ? data_path : schema_path) == -1) {
goto error;
}
free(full_msg);
full_msg = aux;
}
if (line) {
if (asprintf(&aux, "%s (line %" PRIu64 ")", full_msg, line) == -1) {
goto error;
}
free(full_msg);
full_msg = aux;
}
fprintf(stderr, "%s\n", full_msg);
free(full_msg);
return;
error:
free(full_msg);
fprintf(stderr, "libyang %s Memory allocation failed.\n", levstr);
}
static struct yl_schema_features *