aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-13 12:08:30 +0100
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:05 -0500
commit7c6c3159d1804f4855d9a4e0cd52486f61fcbab6 (patch)
tree1a678106cccba9bbbfb44deeadfa5bca3606e72c /src/world.c
parenta90341129953e9b8e0e1d96fa52b10cbf34d1ea1 (diff)
downloadserd-7c6c3159d1804f4855d9a4e0cd52486f61fcbab6.tar.gz
serd-7c6c3159d1804f4855d9a4e0cd52486f61fcbab6.tar.bz2
serd-7c6c3159d1804f4855d9a4e0cd52486f61fcbab6.zip
Add SerdCursor
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/world.c b/src/world.c
index 9503c578..1b66f025 100644
--- a/src/world.c
+++ b/src/world.c
@@ -18,6 +18,7 @@
#include "world.h"
+#include "cursor.h"
#include "node.h"
#include "serd_config.h"
@@ -57,10 +58,13 @@ serd_world_error(const SerdWorld* world, const SerdError* 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->cursor) {
+ fprintf(stderr,
+ "%s:%u:%u: ",
+ serd_node_string(e->cursor->file),
+ e->cursor->line,
+ e->cursor->col);
}
vfprintf(stderr, e->fmt, *e->args);
}
@@ -72,7 +76,7 @@ serd_world_errorf(const SerdWorld* world, SerdStatus st, const char* fmt, ...)
{
va_list args;
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;