diff options
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r-- | src/serd_internal.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h index b3221ae7..0c9d4609 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -4,7 +4,10 @@ #ifndef SERD_SRC_SERD_INTERNAL_H #define SERD_SRC_SERD_INTERNAL_H +#include "world.h" + #include "serd/error.h" +#include "serd/world.h" #include <stdio.h> @@ -20,12 +23,16 @@ /* Error reporting */ static inline void -serd_error(SerdErrorFunc error_func, void* handle, const SerdError* e) +serd_error(const SerdWorld* world, const SerdError* e) { - if (error_func) { - error_func(handle, e); + if (world->error_func) { + world->error_func(world->error_handle, e); } else { - fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col); + if (e->filename) { + fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col); + } else { + fprintf(stderr, "error: "); + } vfprintf(stderr, e->fmt, *e->args); } } |