diff options
author | David Robillard <d@drobilla.net> | 2021-03-01 13:24:02 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-07 15:32:24 -0500 |
commit | 58890c798fbd87a2080c2fa8cc206a2631c3e558 (patch) | |
tree | acc1eae84774a9b46cb7c021f939f7229c1a3383 /src | |
parent | ee254d3e92900986526078bb9cbef1642a51dac1 (diff) | |
download | serd-58890c798fbd87a2080c2fa8cc206a2631c3e558.tar.gz serd-58890c798fbd87a2080c2fa8cc206a2631c3e558.tar.bz2 serd-58890c798fbd87a2080c2fa8cc206a2631c3e558.zip |
Use consistent naming for function types
Diffstat (limited to 'src')
-rw-r--r-- | src/env.c | 2 | ||||
-rw-r--r-- | src/n3.c | 12 | ||||
-rw-r--r-- | src/reader.c | 26 | ||||
-rw-r--r-- | src/reader.h | 10 | ||||
-rw-r--r-- | src/serd_internal.h | 6 | ||||
-rw-r--r-- | src/serdi.c | 8 | ||||
-rw-r--r-- | src/writer.c | 8 |
7 files changed, 36 insertions, 36 deletions
@@ -230,7 +230,7 @@ serd_env_expand_node(const SerdEnv* env, const SerdNode* node) } void -serd_env_foreach(const SerdEnv* env, SerdPrefixSink func, void* handle) +serd_env_foreach(const SerdEnv* env, SerdPrefixFunc func, void* handle) { for (size_t i = 0; i < env->n_prefixes; ++i) { func(handle, env->prefixes[i].name, env->prefixes[i].uri); @@ -1091,8 +1091,8 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, Ref* dest) return r_err(reader, SERD_ERR_BAD_SYNTAX, "`.' inside blank\n"); } read_ws_star(reader); - if (reader->end_sink) { - reader->end_sink(reader->handle, deref(reader, *dest)); + if (reader->end_func) { + reader->end_func(reader->handle, deref(reader, *dest)); } *ctx.flags = old_flags; } @@ -1432,8 +1432,8 @@ read_base(SerdReader* reader, bool sparql, bool token) Ref uri = 0; TRY(st, read_IRIREF(reader, &uri)); - if (reader->base_sink) { - TRY(st, reader->base_sink(reader->handle, deref(reader, uri))); + if (reader->base_func) { + TRY(st, reader->base_func(reader->handle, deref(reader, uri))); } pop_node(reader, uri); @@ -1472,8 +1472,8 @@ read_prefixID(SerdReader* reader, bool sparql, bool token) Ref uri = 0; TRY(st, read_IRIREF(reader, &uri)); - if (reader->prefix_sink) { - st = reader->prefix_sink( + if (reader->prefix_func) { + st = reader->prefix_func( reader->handle, deref(reader, name), deref(reader, uri)); } diff --git a/src/reader.c b/src/reader.c index 0c4ff5e2..d5de67d2 100644 --- a/src/reader.c +++ b/src/reader.c @@ -37,7 +37,7 @@ r_err(SerdReader* reader, SerdStatus st, const char* fmt, ...) va_start(args, fmt); const Cursor* const cur = &reader->source.cur; const SerdError e = {st, cur->filename, cur->line, cur->col, fmt, &args}; - serd_error(reader->error_sink, reader->error_handle, &e); + serd_error(reader->error_func, reader->error_handle, &e); va_end(args); return st; } @@ -132,9 +132,9 @@ emit_statement(SerdReader* reader, ReadContext ctx, Ref o) graph = reader->default_graph; } - const SerdStatus st = !reader->statement_sink + const SerdStatus st = !reader->statement_func ? SERD_SUCCESS - : reader->statement_sink(reader->handle, + : reader->statement_func(reader->handle, *ctx.flags, graph, deref(reader, ctx.subject), @@ -169,18 +169,18 @@ SerdReader* serd_reader_new(SerdSyntax syntax, void* handle, void (*free_handle)(void*), - SerdBaseSink base_sink, - SerdPrefixSink prefix_sink, - SerdStatementSink statement_sink, - SerdEndSink end_sink) + SerdBaseFunc base_func, + SerdPrefixFunc prefix_func, + SerdStatementFunc statement_func, + SerdEndFunc end_func) { SerdReader* me = (SerdReader*)calloc(1, sizeof(SerdReader)); me->handle = handle; me->free_handle = free_handle; - me->base_sink = base_sink; - me->prefix_sink = prefix_sink; - me->statement_sink = statement_sink; - me->end_sink = end_sink; + me->base_func = base_func; + me->prefix_func = prefix_func; + me->statement_func = statement_func; + me->end_func = end_func; me->default_graph = NULL; me->stack = serd_stack_new(SERD_PAGE_SIZE); me->syntax = syntax; @@ -202,10 +202,10 @@ serd_reader_set_strict(SerdReader* reader, bool strict) void serd_reader_set_error_sink(SerdReader* reader, - SerdErrorSink error_sink, + SerdErrorFunc error_func, void* error_handle) { - reader->error_sink = error_sink; + reader->error_func = error_func; reader->error_handle = error_handle; } diff --git a/src/reader.h b/src/reader.h index c598f6b3..8df16da3 100644 --- a/src/reader.h +++ b/src/reader.h @@ -59,11 +59,11 @@ typedef struct { struct SerdReaderImpl { void* handle; void (*free_handle)(void* ptr); - SerdBaseSink base_sink; - SerdPrefixSink prefix_sink; - SerdStatementSink statement_sink; - SerdEndSink end_sink; - SerdErrorSink error_sink; + SerdBaseFunc base_func; + SerdPrefixFunc prefix_func; + SerdStatementFunc statement_func; + SerdEndFunc end_func; + SerdErrorFunc error_func; void* error_handle; Ref rdf_first; Ref rdf_rest; diff --git a/src/serd_internal.h b/src/serd_internal.h index 139e6659..e16a2c12 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -33,10 +33,10 @@ /* Error reporting */ static inline void -serd_error(SerdErrorSink error_sink, void* handle, const SerdError* e) +serd_error(SerdErrorFunc error_func, void* handle, const SerdError* e) { - if (error_sink) { - error_sink(handle, e); + if (error_func) { + error_func(handle, e); } else { fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col); vfprintf(stderr, e->fmt, *e->args); diff --git a/src/serdi.c b/src/serdi.c index 62d1e44a..c54d82e6 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -343,10 +343,10 @@ main(int argc, char** argv) serd_reader_new(input_syntax, writer, NULL, - (SerdBaseSink)serd_writer_set_base_uri, - (SerdPrefixSink)serd_writer_set_prefix, - (SerdStatementSink)serd_writer_write_statement, - (SerdEndSink)serd_writer_end_anon); + (SerdBaseFunc)serd_writer_set_base_uri, + (SerdPrefixFunc)serd_writer_set_prefix, + (SerdStatementFunc)serd_writer_write_statement, + (SerdEndFunc)serd_writer_end_anon); serd_reader_set_strict(reader, !lax); if (quiet) { diff --git a/src/writer.c b/src/writer.c index c70c5f1d..e23058f0 100644 --- a/src/writer.c +++ b/src/writer.c @@ -99,7 +99,7 @@ struct SerdWriterImpl { SerdURIView root_uri; SerdStack anon_stack; SerdByteSink byte_sink; - SerdErrorSink error_sink; + SerdErrorFunc error_func; void* error_handle; WriteContext context; SerdNode* list_subj; @@ -143,7 +143,7 @@ w_err(SerdWriter* writer, SerdStatus st, const char* fmt, ...) va_list args; va_start(args, fmt); const SerdError e = {st, "", 0, 0, fmt, &args}; - serd_error(writer->error_sink, writer->error_handle, &e); + serd_error(writer->error_func, writer->error_handle, &e); va_end(args); } @@ -981,10 +981,10 @@ serd_writer_new(SerdSyntax syntax, void serd_writer_set_error_sink(SerdWriter* writer, - SerdErrorSink error_sink, + SerdErrorFunc error_func, void* error_handle) { - writer->error_sink = error_sink; + writer->error_func = error_func; writer->error_handle = error_handle; } |