aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-10-23 22:11:35 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:07 -0500
commit38f85ad8c53c618033e3d0b7cb1fe782c38cf0a3 (patch)
tree8f5f1e7be38d98c9e354a67bdf7b94a3e35c3a60 /src/world.c
parent3b89559e4c08202bee228e25ea42a4371e333c9b (diff)
downloadserd-38f85ad8c53c618033e3d0b7cb1fe782c38cf0a3.tar.gz
serd-38f85ad8c53c618033e3d0b7cb1fe782c38cf0a3.tar.bz2
serd-38f85ad8c53c618033e3d0b7cb1fe782c38cf0a3.zip
Add SerdCaret
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/world.c b/src/world.c
index ececd646..21cdffab 100644
--- a/src/world.c
+++ b/src/world.c
@@ -3,10 +3,13 @@
#include "world.h"
+#include "caret.h"
#include "node.h"
#include "serd_config.h"
#include "system.h"
+#include "serd/node.h"
+
#include "serd/string_view.h"
#if defined(USE_POSIX_FADVISE)
@@ -45,10 +48,13 @@ serd_world_error(const SerdWorld* const world, const SerdError* const e)
if (world->error_func) {
world->error_func(world->error_handle, e);
} else {
- if (e->filename) {
- fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col);
- } else {
- fprintf(stderr, "error: ");
+ fprintf(stderr, "error: ");
+ if (e->caret) {
+ fprintf(stderr,
+ "%s:%u:%u: ",
+ serd_node_string(e->caret->document),
+ e->caret->line,
+ e->caret->col);
}
vfprintf(stderr, e->fmt, *e->args);
}
@@ -64,7 +70,7 @@ serd_world_verrorf(const SerdWorld* const world,
va_list args_copy;
va_copy(args_copy, args);
- const SerdError e = {st, NULL, 0, 0, fmt, &args_copy};
+ const SerdError e = {st, NULL, fmt, &args_copy};
serd_world_error(world, &e);
va_end(args_copy);
return st;
@@ -78,7 +84,7 @@ serd_world_errorf(const SerdWorld* const world,
{
va_list args; // NOLINT(cppcoreguidelines-init-variables)
va_start(args, fmt);
- const SerdError e = {st, NULL, 0, 0, fmt, &args};
+ const SerdError e = {st, NULL, fmt, &args};
serd_world_error(world, &e);
va_end(args);
return st;