aboutsummaryrefslogtreecommitdiffstats
path: root/src/serd_internal.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-04-29 15:24:05 +0200
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commit3bdf4986884e26b40b0c9d010634a0c572c84122 (patch)
tree666235b035bf0d637d15c6461393508f90660801 /src/serd_internal.h
parent79bd5c789631ea51071564813046e34b304e1bc7 (diff)
downloadserd-3bdf4986884e26b40b0c9d010634a0c572c84122.tar.gz
serd-3bdf4986884e26b40b0c9d010634a0c572c84122.tar.bz2
serd-3bdf4986884e26b40b0c9d010634a0c572c84122.zip
Add SerdWorld for shared library state
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r--src/serd_internal.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h
index 03d4edbd..26846312 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -17,8 +17,14 @@
#ifndef SERD_INTERNAL_H
#define SERD_INTERNAL_H
+#include "world.h"
+
#include "serd/serd.h"
+#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO)
+# include <fcntl.h>
+#endif
+
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -38,12 +44,16 @@
/* Error reporting */
static inline void
-serd_error(SerdErrorSink error_sink, void* handle, const SerdError* e)
+serd_error(const SerdWorld* world, const SerdError* e)
{
- if (error_sink) {
- error_sink(handle, 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);
+ 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);
}
}