diff options
Diffstat (limited to 'src/uri_utils.h')
-rw-r--r-- | src/uri_utils.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/uri_utils.h b/src/uri_utils.h index e2f30edb..c9f3ecf5 100644 --- a/src/uri_utils.h +++ b/src/uri_utils.h @@ -9,7 +9,6 @@ #include "string_utils.h" #include <stdbool.h> -#include <stdint.h> #include <string.h> typedef struct { @@ -20,8 +19,7 @@ typedef struct { static inline bool chunk_equals(const SerdChunk* a, const SerdChunk* b) { - return a->len == b->len && - !strncmp((const char*)a->buf, (const char*)b->buf, a->len); + return a->len == b->len && !strncmp(a->buf, b->buf, a->len); } static inline size_t @@ -30,11 +28,14 @@ uri_path_len(const SerdURI* uri) return uri->path_base.len + uri->path.len; } -static inline uint8_t +static inline char uri_path_at(const SerdURI* uri, size_t i) { - return (i < uri->path_base.len) ? uri->path_base.buf[i] - : uri->path.buf[i - uri->path_base.len]; + if (i < uri->path_base.len) { + return uri->path_base.buf[i]; + } + + return uri->path.buf[i - uri->path_base.len]; } /** @@ -60,8 +61,8 @@ uri_rooted_index(const SerdURI* uri, const SerdURI* root) const size_t root_len = uri_path_len(root); const size_t min_len = path_len < root_len ? path_len : root_len; for (size_t i = 0; i < min_len; ++i) { - const uint8_t u = uri_path_at(uri, i); - const uint8_t r = uri_path_at(root, i); + const char u = uri_path_at(uri, i); + const char r = uri_path_at(root, i); if (u == r) { if (u == '/') { |