aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-12 18:24:19 +0200
committerDavid Robillard <d@drobilla.net>2022-01-13 15:33:54 -0500
commit5126deddc9ef239d1f65e21327cb440fe7a67031 (patch)
tree8116d144130f3c29a6b532f174cf35b1632ae28d
parentda8e12fcbccf4558d4d524d7a6f659ea2ffc0ea2 (diff)
downloadserd-5126deddc9ef239d1f65e21327cb440fe7a67031.tar.gz
serd-5126deddc9ef239d1f65e21327cb440fe7a67031.tar.bz2
serd-5126deddc9ef239d1f65e21327cb440fe7a67031.zip
Remove "get" from accessor names
-rw-r--r--include/serd/serd.h8
-rw-r--r--src/env.c2
-rw-r--r--src/reader.c2
-rw-r--r--src/writer.c13
-rw-r--r--test/test_env.c6
-rw-r--r--test/test_reader_writer.c8
6 files changed, 21 insertions, 18 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 7bccfc76..3fe49c35 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -629,8 +629,8 @@ serd_env_free(SerdEnv* SERD_NULLABLE env);
/// Get the current base URI
SERD_API
const SerdNode* SERD_NONNULL
-serd_env_get_base_uri(const SerdEnv* SERD_NONNULL env,
- SerdURIView* SERD_NULLABLE out);
+serd_env_base_uri(const SerdEnv* SERD_NONNULL env,
+ SerdURIView* SERD_NULLABLE out);
/// Set the current base URI
SERD_API
@@ -742,7 +742,7 @@ serd_reader_set_error_sink(SerdReader* SERD_NONNULL reader,
/// Return the `handle` passed to serd_reader_new()
SERD_PURE_API
void* SERD_NULLABLE
-serd_reader_get_handle(const SerdReader* SERD_NONNULL reader);
+serd_reader_handle(const SerdReader* SERD_NONNULL reader);
/**
Set a prefix to be added to all blank node identifiers.
@@ -896,7 +896,7 @@ serd_writer_free(SerdWriter* SERD_NULLABLE writer);
/// Return the env used by `writer`
SERD_PURE_API
SerdEnv* SERD_NONNULL
-serd_writer_get_env(SerdWriter* SERD_NONNULL writer);
+serd_writer_env(SerdWriter* SERD_NONNULL writer);
/**
A convenience sink function for writing to a FILE*.
diff --git a/src/env.c b/src/env.c
index 797e947a..bea38a6d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -62,7 +62,7 @@ serd_env_free(SerdEnv* const env)
}
const SerdNode*
-serd_env_get_base_uri(const SerdEnv* const env, SerdURIView* const out)
+serd_env_base_uri(const SerdEnv* const env, SerdURIView* const out)
{
if (out) {
*out = env->base_uri;
diff --git a/src/reader.c b/src/reader.c
index b2fc0038..cc30c86e 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -254,7 +254,7 @@ serd_reader_free(SerdReader* const reader)
}
void*
-serd_reader_get_handle(const SerdReader* const reader)
+serd_reader_handle(const SerdReader* const reader)
{
return reader->handle;
}
diff --git a/src/writer.c b/src/writer.c
index 9e345470..579c7f3e 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -576,6 +576,10 @@ write_uri_node(SerdWriter* const writer,
return sink("a", 1, writer) == 1;
}
+ if (!strcmp(node->buf, NS_RDF "nil")) {
+ return sink("()", 2, writer) == 2;
+ }
+
if (has_scheme && (writer->flags & SERD_WRITE_CURIED) &&
serd_env_qualify(writer->env, node, &prefix, &suffix) &&
is_name(prefix.buf, prefix.n_bytes) &&
@@ -588,7 +592,7 @@ write_uri_node(SerdWriter* const writer,
}
if (!has_scheme && !supports_uriref(writer) &&
- !serd_env_get_base_uri(writer->env, NULL)->buf) {
+ !serd_env_base_uri(writer->env, NULL)->buf) {
w_err(writer,
SERD_ERR_BAD_ARG,
"syntax does not support URI reference <%s>\n",
@@ -601,7 +605,7 @@ write_uri_node(SerdWriter* const writer,
SerdURIView in_base_uri;
SerdURIView uri;
SerdURIView abs_uri;
- serd_env_get_base_uri(writer->env, &in_base_uri);
+ serd_env_base_uri(writer->env, &in_base_uri);
serd_uri_parse(node->buf, &uri);
serd_uri_resolve(&uri, &in_base_uri, &abs_uri);
bool rooted = uri_is_under(&writer->base_uri, &writer->root_uri);
@@ -989,7 +993,7 @@ SerdStatus
serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri)
{
if (!serd_env_set_base_uri(writer->env, uri)) {
- serd_env_get_base_uri(writer->env, &writer->base_uri);
+ serd_env_base_uri(writer->env, &writer->base_uri);
if (writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG) {
if (writer->context.graph.type || writer->context.subject.type) {
@@ -1003,7 +1007,6 @@ serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri)
writer->indent = 0;
return reset_context(writer, true);
}
-
return SERD_ERR_UNKNOWN;
}
@@ -1063,7 +1066,7 @@ serd_writer_free(SerdWriter* writer)
}
SerdEnv*
-serd_writer_get_env(SerdWriter* writer)
+serd_writer_env(SerdWriter* writer)
{
return writer->env;
}
diff --git a/test/test_env.c b/test/test_env.c
index 0ca17b79..f0dd4d47 100644
--- a/test/test_env.c
+++ b/test/test_env.c
@@ -42,7 +42,7 @@ test_env(void)
assert(!serd_env_set_base_uri(env, NULL));
assert(serd_env_set_base_uri(env, &SERD_NODE_NULL));
- assert(serd_node_equals(serd_env_get_base_uri(env, NULL), &SERD_NODE_NULL));
+ assert(serd_node_equals(serd_env_base_uri(env, NULL), &SERD_NODE_NULL));
SerdStringView prefix;
SerdStringView suffix;
@@ -87,9 +87,9 @@ test_env(void)
assert(!serd_env_qualify(env, &shorter_uri, &prefix_name, &suffix));
assert(!serd_env_set_base_uri(env, &u));
- assert(serd_node_equals(serd_env_get_base_uri(env, NULL), &u));
+ assert(serd_node_equals(serd_env_base_uri(env, NULL), &u));
assert(!serd_env_set_base_uri(env, NULL));
- assert(!serd_env_get_base_uri(env, NULL)->buf);
+ assert(!serd_env_base_uri(env, NULL)->buf);
serd_env_free(env);
}
diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c
index 287a2bfc..3a1a103d 100644
--- a/test/test_reader_writer.c
+++ b/test/test_reader_writer.c
@@ -107,7 +107,7 @@ test_read_chunks(void)
serd_reader_new(SERD_TURTLE, rt, free, NULL, NULL, test_sink, NULL);
assert(reader);
- assert(serd_reader_get_handle(reader) == rt);
+ assert(serd_reader_handle(reader) == rt);
assert(f);
SerdStatus st = serd_reader_start_stream(reader, f, NULL, false);
@@ -163,7 +163,7 @@ test_read_string(void)
serd_reader_new(SERD_TURTLE, rt, free, NULL, NULL, test_sink, NULL);
assert(reader);
- assert(serd_reader_get_handle(reader) == rt);
+ assert(serd_reader_handle(reader) == rt);
// Test reading a string that ends exactly at the end of input (no newline)
const SerdStatus st =
@@ -196,7 +196,7 @@ test_writer(const char* const path)
assert(serd_writer_set_base_uri(writer, &lit));
assert(serd_writer_set_prefix(writer, &lit, &lit));
assert(serd_writer_end_anon(writer, NULL));
- assert(serd_writer_get_env(writer) == env);
+ assert(serd_writer_env(writer) == env);
uint8_t buf[] = {0xEF, 0xBF, 0xBD, 0};
SerdNode s = serd_node_from_string(SERD_URI, "");
@@ -298,7 +298,7 @@ test_reader(const char* path)
SerdReader* reader =
serd_reader_new(SERD_TURTLE, rt, free, NULL, NULL, test_sink, NULL);
assert(reader);
- assert(serd_reader_get_handle(reader) == rt);
+ assert(serd_reader_handle(reader) == rt);
SerdNode g = serd_node_from_string(SERD_URI, "http://example.org/");
serd_reader_set_default_graph(reader, &g);