diff options
Diffstat (limited to 'src/env.c')
-rw-r--r-- | src/env.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -4,7 +4,6 @@ #include "serd/serd.h" #include <stdbool.h> -#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -91,7 +90,7 @@ serd_env_set_base_uri(SerdEnv* const env, const SerdNode* const uri) SERD_PURE_FUNC static SerdPrefix* serd_env_find(const SerdEnv* const env, - const uint8_t* const name, + const char* const name, const size_t name_len) { for (size_t i = 0; i < env->n_prefixes; ++i) { @@ -156,9 +155,9 @@ serd_env_set_prefix(SerdEnv* const env, } SerdStatus -serd_env_set_prefix_from_strings(SerdEnv* const env, - const uint8_t* const name, - const uint8_t* const uri) +serd_env_set_prefix_from_strings(SerdEnv* const env, + const char* const name, + const char* const uri) { const SerdNode name_node = serd_node_from_string(SERD_LITERAL, name); const SerdNode uri_node = serd_node_from_string(SERD_URI, uri); @@ -179,9 +178,7 @@ serd_env_qualify(const SerdEnv* const env, for (size_t i = 0; i < env->n_prefixes; ++i) { const SerdNode* const prefix_uri = &env->prefixes[i].uri; if (uri->n_bytes >= prefix_uri->n_bytes) { - if (!strncmp((const char*)uri->buf, - (const char*)prefix_uri->buf, - prefix_uri->n_bytes)) { + if (!strncmp(uri->buf, prefix_uri->buf, prefix_uri->n_bytes)) { *prefix = env->prefixes[i].name; suffix->buf = uri->buf + prefix_uri->n_bytes; suffix->len = uri->n_bytes - prefix_uri->n_bytes; @@ -202,8 +199,8 @@ serd_env_expand(const SerdEnv* const env, return SERD_ERR_BAD_CURIE; } - const uint8_t* const colon = - (const uint8_t*)memchr(curie->buf, ':', curie->n_bytes + 1); + const char* const colon = + (const char*)memchr(curie->buf, ':', curie->n_bytes + 1); if (curie->type != SERD_CURIE || !colon) { return SERD_ERR_BAD_ARG; } @@ -242,9 +239,9 @@ serd_env_expand_node(const SerdEnv* const env, const SerdNode* const node) return SERD_NODE_NULL; } const size_t len = prefix.len + suffix.len; - uint8_t* buf = (uint8_t*)malloc(len + 1); + char* buf = (char*)malloc(len + 1); SerdNode ret = {buf, len, 0, SERD_URI}; - snprintf((char*)buf, ret.n_bytes + 1, "%s%s", prefix.buf, suffix.buf); + snprintf(buf, ret.n_bytes + 1, "%s%s", prefix.buf, suffix.buf); return ret; } case SERD_BLANK: |