Merging upstream version 3.12.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
6375ddbe5b
commit
580fa3f55c
66 changed files with 4041 additions and 2142 deletions
|
@ -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 *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue