diff options
author | David Robillard <d@drobilla.net> | 2021-01-13 19:30:45 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:05 -0500 |
commit | 10c706a040abeaf5c82db54086d4edb03a995cf3 (patch) | |
tree | a9eec56499e1f2cb90a623267b9be4d1453ce99e /src/serd_internal.h | |
parent | 024553949ab66abdea597bed386b2f36018df337 (diff) | |
download | serd-10c706a040abeaf5c82db54086d4edb03a995cf3.tar.gz serd-10c706a040abeaf5c82db54086d4edb03a995cf3.tar.bz2 serd-10c706a040abeaf5c82db54086d4edb03a995cf3.zip |
Add SerdWorld for shared library state
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r-- | src/serd_internal.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h index e16a2c12..1bb2a3bc 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -17,6 +17,8 @@ #ifndef SERD_INTERNAL_H #define SERD_INTERNAL_H +#include "world.h" + #include "serd/serd.h" #include <stdio.h> @@ -33,12 +35,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); } } |