aboutsummaryrefslogtreecommitdiffstats
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/env.c b/src/env.c
index afbf1064..13d8129e 100644
--- a/src/env.c
+++ b/src/env.c
@@ -139,6 +139,21 @@ serd_env_set_base_uri(SerdEnv* const env, const SerdStringView uri)
return SERD_SUCCESS;
}
+SerdStringView
+serd_env_find_prefix(const SerdEnv* const env, const SerdStringView name)
+{
+ for (size_t i = 0; i < env->n_prefixes; ++i) {
+ const SerdNode* const prefix_name = env->prefixes[i].name;
+ if (prefix_name->length == name.length) {
+ if (!memcmp(serd_node_string(prefix_name), name.data, name.length)) {
+ return serd_node_string_view(env->prefixes[i].uri);
+ }
+ }
+ }
+
+ return serd_empty_string();
+}
+
ZIX_PURE_FUNC static SerdPrefix*
serd_env_find(const SerdEnv* const env,
const char* const name,