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>2022-01-13 15:33:54 -0500
commitfaac2e52df494481dc28168a856058a414a913f2 (patch)
tree96f6d9433fc7f23a0e1aabdffd61404a273a28cc /src
parent97258f0e85834d71b17e3c1997a5c7dc136e0b98 (diff)
downloadserd-faac2e52df494481dc28168a856058a414a913f2.tar.gz
serd-faac2e52df494481dc28168a856058a414a913f2.tar.bz2
serd-faac2e52df494481dc28168a856058a414a913f2.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.c15
4 files changed, 14 insertions, 19 deletions
diff --git a/src/env.c b/src/env.c
index 9df2c41e..c06068e6 100644
--- a/src/env.c
+++ b/src/env.c
@@ -176,7 +176,7 @@ bool
serd_env_qualify(const SerdEnv* const env,
const SerdNode* const uri,
SerdNode* const prefix,
- SerdChunk* const suffix)
+ SerdStringView* const suffix)
{
if (!env) {
return false;
@@ -199,8 +199,8 @@ serd_env_qualify(const SerdEnv* const env,
SerdStatus
serd_env_expand(const SerdEnv* const env,
const SerdNode* const curie,
- SerdChunk* const uri_prefix,
- SerdChunk* const uri_suffix)
+ SerdStringView* const uri_prefix,
+ SerdStringView* const uri_suffix)
{
if (!env) {
return SERD_ERR_BAD_CURIE;
@@ -240,8 +240,8 @@ serd_env_expand_node(const SerdEnv* const env, const SerdNode* const 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 a7c7a212..82221d7a 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -280,7 +280,7 @@ remove_dot_segments(const char* const path, const size_t len, size_t* const up)
/// Merge `base` and `path` in-place
static void
-merge(SerdChunk* const base, SerdChunk* const path)
+merge(SerdStringView* const base, SerdStringView* const 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 84c704ee..c613b00c 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -567,8 +567,8 @@ write_uri_node(SerdWriter* const writer,
const SerdNode* node,
const Field field)
{
- SerdNode prefix;
- SerdChunk suffix;
+ SerdNode prefix;
+ SerdStringView suffix;
const bool has_scheme = serd_uri_string_has_scheme(node->buf);
if (supports_abbrev(writer)) {
@@ -576,10 +576,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(prefix.buf, prefix.n_bytes) &&
@@ -627,10 +623,9 @@ write_uri_node(SerdWriter* const writer,
static bool
write_curie(SerdWriter* const writer, const SerdNode* const node)
{
- 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: