From 05601551a3e8350da8053f47ceb121c8de0e692c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Mar 2016 16:54:49 -0400 Subject: Rename SerdChunk to SerdStringView --- src/env.c | 10 +++++----- src/serd_internal.h | 6 +++--- src/uri.c | 2 +- src/writer.c | 11 +++++------ 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/env.c b/src/env.c index 90060e84..34e8cad9 100644 --- a/src/env.c +++ b/src/env.c @@ -160,7 +160,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; @@ -179,8 +179,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); @@ -206,8 +206,8 @@ serd_env_expand_node(const SerdEnv* env, { switch (node->type) { 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/serd_internal.h b/src/serd_internal.h index 422d6228..b6acf6fd 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -451,7 +451,7 @@ parse_utf8_char(const uint8_t* utf8, size_t* size) /* URI utilities */ 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); } @@ -480,8 +480,8 @@ static inline 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/uri.c b/src/uri.c index a9f40937..ab1b1799 100644 --- a/src/uri.c +++ b/src/uri.c @@ -285,7 +285,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/writer.c b/src/writer.c index f1baaa40..6c99ea0f 100644 --- a/src/writer.c +++ b/src/writer.c @@ -488,8 +488,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; @@ -548,10 +548,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: -- cgit v1.2.1