aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-16 16:54:49 -0400
committerDavid Robillard <d@drobilla.net>2021-03-07 15:32:23 -0500
commitb4dee10576e9916c0c8d80033bc429dc38a70c1c (patch)
tree58d9b4a8eea080691ab0177e25dae1001ba711ba /src
parenta29581d3ba664175c459e20e6c86be09707fde6e (diff)
downloadserd-b4dee10576e9916c0c8d80033bc429dc38a70c1c.tar.gz
serd-b4dee10576e9916c0c8d80033bc429dc38a70c1c.tar.bz2
serd-b4dee10576e9916c0c8d80033bc429dc38a70c1c.zip
Rename SerdChunk to SerdStringView
Diffstat (limited to 'src')
-rw-r--r--src/env.c10
-rw-r--r--src/uri.c2
-rw-r--r--src/uri_utils.h6
-rw-r--r--src/writer.c16
4 files changed, 14 insertions, 20 deletions
diff --git a/src/env.c b/src/env.c
index 9d4721d2..c319ce54 100644
--- a/src/env.c
+++ b/src/env.c
@@ -170,7 +170,7 @@ bool
serd_env_qualify(const SerdEnv* env,
const SerdNode* uri,
SerdNode* prefix,
- SerdChunk* suffix)
+ SerdStringView* suffix)
{
for (size_t i = 0; i < env->n_prefixes; ++i) {
const SerdNode* const prefix_uri = &env->prefixes[i].uri;
@@ -189,8 +189,8 @@ serd_env_qualify(const SerdEnv* env,
SerdStatus
serd_env_expand(const SerdEnv* env,
const SerdNode* curie,
- SerdChunk* uri_prefix,
- SerdChunk* uri_suffix)
+ SerdStringView* uri_prefix,
+ SerdStringView* uri_suffix)
{
const char* const colon =
(const char*)memchr(curie->buf, ':', curie->n_bytes + 1);
@@ -222,8 +222,8 @@ serd_env_expand_node(const SerdEnv* env, const SerdNode* node)
return serd_node_new_uri_from_node(node, &env->base_uri, &ignored);
}
case SERD_CURIE: {
- SerdChunk prefix;
- SerdChunk suffix;
+ SerdStringView prefix;
+ SerdStringView suffix;
if (serd_env_expand(env, node, &prefix, &suffix)) {
return SERD_NODE_NULL;
}
diff --git a/src/uri.c b/src/uri.c
index 93beeffe..01384072 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -279,7 +279,7 @@ remove_dot_segments(const char* path, size_t len, size_t* up)
/// Merge `base` and `path` in-place
static void
-merge(SerdChunk* base, SerdChunk* path)
+merge(SerdStringView* base, SerdStringView* path)
{
size_t up = 0;
const char* begin = remove_dot_segments(path->buf, path->len, &up);
diff --git a/src/uri_utils.h b/src/uri_utils.h
index 2544eea2..735555c4 100644
--- a/src/uri_utils.h
+++ b/src/uri_utils.h
@@ -25,7 +25,7 @@
#include <string.h>
static inline bool
-chunk_equals(const SerdChunk* a, const SerdChunk* b)
+slice_equals(const SerdStringView* a, const SerdStringView* b)
{
return a->len == b->len && !strncmp(a->buf, b->buf, a->len);
}
@@ -54,8 +54,8 @@ static inline SERD_PURE_FUNC size_t
uri_rooted_index(const SerdURI* uri, const SerdURI* root)
{
if (!root || !root->scheme.len ||
- !chunk_equals(&root->scheme, &uri->scheme) ||
- !chunk_equals(&root->authority, &uri->authority)) {
+ !slice_equals(&root->scheme, &uri->scheme) ||
+ !slice_equals(&root->authority, &uri->authority)) {
return 0;
}
diff --git a/src/writer.c b/src/writer.c
index dce47599..e97af301 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -564,8 +564,8 @@ write_uri_node(SerdWriter* const writer,
const Field field,
const SerdStatementFlags flags)
{
- SerdNode prefix;
- SerdChunk suffix;
+ SerdNode prefix;
+ SerdStringView suffix;
if (is_inline_start(writer, field, flags)) {
++writer->indent;
@@ -579,10 +579,6 @@ 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->style & SERD_STYLE_CURIED) &&
serd_env_qualify(writer->env, node, &prefix, &suffix) &&
is_name(suffix.buf, suffix.len)) {
@@ -636,10 +632,9 @@ write_curie(SerdWriter* const writer,
const Field field,
const SerdStatementFlags flags)
{
- SerdChunk prefix = {NULL, 0};
- SerdChunk suffix = {NULL, 0};
- SerdStatus st = SERD_SUCCESS;
-
+ SerdStringView prefix = {NULL, 0};
+ SerdStringView suffix = {NULL, 0};
+ SerdStatus st = SERD_SUCCESS;
switch (writer->syntax) {
case SERD_NTRIPLES:
case SERD_NQUADS:
@@ -665,7 +660,6 @@ write_curie(SerdWriter* const writer,
write_newline(writer);
}
}
-
return true;
}