From cd30f11644697d7b1a38c171007c57379bec79df Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 3 Jun 2018 22:15:53 +0200 Subject: Add SerdCursor to public API --- src/world.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/world.c') diff --git a/src/world.c b/src/world.c index 27feeac6..d43a2909 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" @@ -54,7 +55,14 @@ serd_world_error(const SerdWorld* world, const SerdError* e) if (world->error_sink) { world->error_sink(world->error_handle, e); } else { - fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col); + fprintf(stderr, "error: "); + if (e->cursor) { + fprintf(stderr, + "%s:%u:%u: ", + serd_node_get_string(e->cursor->file), + e->cursor->line, + e->cursor->col); + } vfprintf(stderr, e->fmt, *e->args); } return e->status; @@ -65,7 +73,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; -- cgit v1.2.1