aboutsummaryrefslogtreecommitdiffstats
path: root/src/serd_internal.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-11 15:28:43 +0200
committerDavid Robillard <d@drobilla.net>2018-06-10 19:57:44 +0000
commitd208424fdb4e8b516aff2a5a0d03fc7411909471 (patch)
treeb293d21b26329c6522bd6cb769f30917c14f1bf1 /src/serd_internal.h
parent480744aab736a669c548cb5ced68866c3ebffb4e (diff)
downloadserd-d208424fdb4e8b516aff2a5a0d03fc7411909471.tar.gz
serd-d208424fdb4e8b516aff2a5a0d03fc7411909471.tar.bz2
serd-d208424fdb4e8b516aff2a5a0d03fc7411909471.zip
Fix relative URI serialisation
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r--src/serd_internal.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h
index cfcdc82c..52dd31ed 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -431,9 +431,9 @@ uri_path_at(const SerdURI* uri, size_t i)
}
}
-/** Return true iff `uri` is within the base of `root` */
+/** Return true iff `uri` shares path components with `root` */
static inline bool
-uri_is_under(const SerdURI* uri, const SerdURI* root)
+uri_is_related(const SerdURI* uri, const SerdURI* root)
{
if (!root || !root->scheme.len ||
!chunk_equals(&root->scheme, &uri->scheme) ||
@@ -456,6 +456,13 @@ uri_is_under(const SerdURI* uri, const SerdURI* root)
return true;
}
+/** Return true iff `uri` is within the base of `root` */
+static inline bool
+uri_is_under(const SerdURI* uri, const SerdURI* root)
+{
+ return uri->path.len >= root->path.len && uri_is_related(uri, root);
+}
+
static inline bool
is_uri_scheme_char(const uint8_t c)
{