aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-02-24 09:02:00 +0100
committerDavid Robillard <d@drobilla.net>2019-04-13 19:15:32 +0200
commit9a20ce6e56e6f98ef235e18cbd7f8a2432ede998 (patch)
tree78640c60005901d127ac640ae2f146f99f211459
parent18a4fbdf46e681e66238ebd3f895c3dc850e691e (diff)
downloadserd-9a20ce6e56e6f98ef235e18cbd7f8a2432ede998.tar.gz
serd-9a20ce6e56e6f98ef235e18cbd7f8a2432ede998.tar.bz2
serd-9a20ce6e56e6f98ef235e18cbd7f8a2432ede998.zip
Use consistent naming for function types
-rw-r--r--serd/serd.h30
-rw-r--r--src/reader.h2
-rw-r--r--src/sink.c8
-rw-r--r--src/sink.h8
-rw-r--r--src/world.c8
-rw-r--r--src/world.h2
-rw-r--r--src/writer.c10
7 files changed, 34 insertions, 34 deletions
diff --git a/serd/serd.h b/serd/serd.h
index ec5d9228..02698c7f 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -734,46 +734,46 @@ serd_node_free(SerdNode* node);
*/
/**
- Sink (callback) for log messages
+ Sink function for log messages
@param handle Handle for user data.
@param msg Message description.
*/
-typedef SerdStatus (*SerdMessageSink)(void* handle, const SerdMessage* msg);
+typedef SerdStatus (*SerdMessageFunc)(void* handle, const SerdMessage* msg);
/**
- Sink (callback) for base URI changes
+ Sink function for base URI changes
Called whenever the base URI of the serialisation changes.
*/
-typedef SerdStatus (*SerdBaseSink)(void* handle, const SerdNode* uri);
+typedef SerdStatus (*SerdBaseFunc)(void* handle, const SerdNode* uri);
/**
- Sink (callback) for namespace definitions
+ Sink function for namespace definitions
Called whenever a prefix is defined in the serialisation.
*/
-typedef SerdStatus (*SerdPrefixSink)(void* handle,
+typedef SerdStatus (*SerdPrefixFunc)(void* handle,
const SerdNode* name,
const SerdNode* uri);
/**
- Sink (callback) for statements
+ Sink function for statements
Called for every RDF statement in the serialisation.
*/
-typedef SerdStatus (*SerdStatementSink)(void* handle,
+typedef SerdStatus (*SerdStatementFunc)(void* handle,
SerdStatementFlags flags,
const SerdStatement* statement);
/**
- Sink (callback) for anonymous node end markers
+ Sink function for anonymous node end markers
This is called to indicate that the anonymous node with the given
`value` will no longer be referred to by any future statements
(i.e. the anonymous serialisation of the node is finished).
*/
-typedef SerdStatus (*SerdEndSink)(void* handle, const SerdNode* node);
+typedef SerdStatus (*SerdEndFunc)(void* handle, const SerdNode* node);
/**
@}
@@ -826,7 +826,7 @@ serd_world_get_blank(SerdWorld* world);
SERD_API
void
serd_world_set_message_sink(SerdWorld* world,
- SerdMessageSink msg_sink,
+ SerdMessageFunc msg_func,
void* handle);
/// Write a message to the log
@@ -950,22 +950,22 @@ serd_sink_get_env(const SerdSink* sink);
/// Set a function to be called when the base URI changes
SERD_API
SerdStatus
-serd_sink_set_base_func(SerdSink* sink, SerdBaseSink base_func);
+serd_sink_set_base_func(SerdSink* sink, SerdBaseFunc base_func);
/// Set a function to be called when a namespace prefix is defined
SERD_API
SerdStatus
-serd_sink_set_prefix_func(SerdSink* sink, SerdPrefixSink prefix_func);
+serd_sink_set_prefix_func(SerdSink* sink, SerdPrefixFunc prefix_func);
/// Set a function to be called when a statement is emitted
SERD_API
SerdStatus
-serd_sink_set_statement_func(SerdSink* sink, SerdStatementSink statement_func);
+serd_sink_set_statement_func(SerdSink* sink, SerdStatementFunc statement_func);
/// Set a function to be called when an anonymous node ends
SERD_API
SerdStatus
-serd_sink_set_end_func(SerdSink* sink, SerdEndSink end_func);
+serd_sink_set_end_func(SerdSink* sink, SerdEndFunc end_func);
/// Set the base URI
SERD_API
diff --git a/src/reader.h b/src/reader.h
index 8c0efe3a..62373fc4 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -46,7 +46,7 @@ typedef struct {
struct SerdReaderImpl {
SerdWorld* world;
const SerdSink* sink;
- SerdMessageSink msg_sink;
+ SerdMessageFunc msg_func;
void* error_handle;
SerdNode* rdf_first;
SerdNode* rdf_rest;
diff --git a/src/sink.c b/src/sink.c
index 1b693e88..e62136d9 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -46,28 +46,28 @@ serd_sink_get_env(const SerdSink* sink)
}
SerdStatus
-serd_sink_set_base_func(SerdSink* sink, SerdBaseSink base_func)
+serd_sink_set_base_func(SerdSink* sink, SerdBaseFunc base_func)
{
sink->base = base_func;
return SERD_SUCCESS;
}
SerdStatus
-serd_sink_set_prefix_func(SerdSink* sink, SerdPrefixSink prefix_func)
+serd_sink_set_prefix_func(SerdSink* sink, SerdPrefixFunc prefix_func)
{
sink->prefix = prefix_func;
return SERD_SUCCESS;
}
SerdStatus
-serd_sink_set_statement_func(SerdSink* sink, SerdStatementSink statement_func)
+serd_sink_set_statement_func(SerdSink* sink, SerdStatementFunc statement_func)
{
sink->statement = statement_func;
return SERD_SUCCESS;
}
SerdStatus
-serd_sink_set_end_func(SerdSink* sink, SerdEndSink end_func)
+serd_sink_set_end_func(SerdSink* sink, SerdEndFunc end_func)
{
sink->end = end_func;
return SERD_SUCCESS;
diff --git a/src/sink.h b/src/sink.h
index bab46ef6..1aeafc0a 100644
--- a/src/sink.h
+++ b/src/sink.h
@@ -25,10 +25,10 @@
struct SerdSinkImpl {
void* handle;
SerdEnv* env;
- SerdBaseSink base;
- SerdPrefixSink prefix;
- SerdStatementSink statement;
- SerdEndSink end;
+ SerdBaseFunc base;
+ SerdPrefixFunc prefix;
+ SerdStatementFunc statement;
+ SerdEndFunc end;
};
#endif // SERD_SINK_H
diff --git a/src/world.c b/src/world.c
index 7b0343cc..13b593b2 100644
--- a/src/world.c
+++ b/src/world.c
@@ -53,8 +53,8 @@ serd_world_fopen(SerdWorld* world, const char* path, const char* mode)
SerdStatus
serd_world_log(const SerdWorld* world, const SerdMessage* msg)
{
- if (world->msg_sink) {
- world->msg_sink(world->msg_handle, msg);
+ if (world->msg_func) {
+ world->msg_func(world->msg_handle, msg);
} else {
fprintf(stderr, "error: ");
if (msg->cursor) {
@@ -142,9 +142,9 @@ serd_world_get_blank(SerdWorld* world)
void
serd_world_set_message_sink(SerdWorld* world,
- SerdMessageSink msg_sink,
+ SerdMessageFunc msg_func,
void* handle)
{
- world->msg_sink = msg_sink;
+ world->msg_func = msg_func;
world->msg_handle = handle;
}
diff --git a/src/world.h b/src/world.h
index 9d6dd4d2..ef19fb7f 100644
--- a/src/world.h
+++ b/src/world.h
@@ -24,7 +24,7 @@
struct SerdWorldImpl {
SerdNodes* nodes;
- SerdMessageSink msg_sink;
+ SerdMessageFunc msg_func;
void* msg_handle;
uint32_t next_blank_id;
SerdNode* blank_node;
diff --git a/src/writer.c b/src/writer.c
index 953de1fb..8000e85a 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -110,7 +110,7 @@ struct SerdWriterImpl {
SerdStack anon_stack;
SerdWriteFunc write_func;
void* stream;
- SerdMessageSink msg_sink;
+ SerdMessageFunc msg_func;
void* msg_handle;
WriteContext context;
unsigned indent;
@@ -921,10 +921,10 @@ serd_writer_new(SerdWorld* world,
writer->iface.handle = writer;
writer->iface.env = env;
- writer->iface.base = (SerdBaseSink)serd_writer_set_base_uri;
- writer->iface.prefix = (SerdPrefixSink)serd_writer_set_prefix;
- writer->iface.statement = (SerdStatementSink)serd_writer_write_statement;
- writer->iface.end = (SerdEndSink)serd_writer_end_anon;
+ writer->iface.base = (SerdBaseFunc)serd_writer_set_base_uri;
+ writer->iface.prefix = (SerdPrefixFunc)serd_writer_set_prefix;
+ writer->iface.statement = (SerdStatementFunc)serd_writer_write_statement;
+ writer->iface.end = (SerdEndFunc)serd_writer_end_anon;
return writer;
}