aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-20 20:40:43 +0000
committerDavid Robillard <d@drobilla.net>2011-01-20 20:40:43 +0000
commitec2991ce8c75390a227de2d21a532de1dff0fdfd (patch)
tree695fd1b44e217ca9a592b85bc46c691e32973572 /src/uri.c
parent3433e155c739f6a081209ea7422b9fdc7f87a555 (diff)
downloadserd-ec2991ce8c75390a227de2d21a532de1dff0fdfd.tar.gz
serd-ec2991ce8c75390a227de2d21a532de1dff0fdfd.tar.bz2
serd-ec2991ce8c75390a227de2d21a532de1dff0fdfd.zip
Support passing no base URI on command line (use filename as base URI).
Decent usage output. git-svn-id: http://svn.drobilla.net/serd/trunk@15 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/uri.c b/src/uri.c
index a7e7178c..2d4fdc9f 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -44,29 +44,28 @@ is_digit(const uint8_t c)
return in_range(c, '0', '9');
}
-/** Return true if @a uri is relative (i.e. does not start with a scheme) */
SERD_API
bool
-serd_uri_string_is_relative(const uint8_t* utf8)
+serd_uri_string_has_scheme(const uint8_t* utf8)
{
// RFC3986: scheme ::= ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
if (!is_alpha(utf8[0])) {
- return true; // Invalid scheme initial character, URI is relative
+ return false; // Invalid scheme initial character, URI is relative
}
for (uint8_t c = *++utf8; (c = *utf8) != '\0'; ++utf8) {
switch (c) {
case ':':
- return false; // End of scheme, URI is absolute
+ return true; // End of scheme
case '+': case '-': case '.':
break; // Valid scheme character, continue
default:
if (!is_alpha(c) && !is_digit(c)) {
- return true; // Invalid scheme character, URI is relative
+ return false; // Invalid scheme character
}
}
}
- return true;
+ return false;
}
#ifdef URI_DEBUG
@@ -93,8 +92,7 @@ SERD_API
bool
serd_uri_parse(const uint8_t* utf8, SerdURI* uri)
{
- static const SerdURI null_uri = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
- *uri = null_uri;
+ *uri = SERD_URI_NULL;
assert(uri->path_base.buf == NULL);
assert(uri->path_base.len == 0);
assert(uri->authority.len == 0);