aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-12-20 13:08:46 -0500
committerDavid Robillard <d@drobilla.net>2019-04-13 19:15:32 +0200
commit8f954d7a609c7bf5a955c117c8abbde0eaef3aca (patch)
treeec28fa0350b33a24b4417e1a3cee67a72bddf40c
parentb58e829adcaca5a74f666a3f1b4c76644a7d49b7 (diff)
downloadserd-8f954d7a609c7bf5a955c117c8abbde0eaef3aca.tar.gz
serd-8f954d7a609c7bf5a955c117c8abbde0eaef3aca.tar.bz2
serd-8f954d7a609c7bf5a955c117c8abbde0eaef3aca.zip
Add serd_env_write_prefixes()
-rw-r--r--serd/serd.h7
-rw-r--r--src/env.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/serd/serd.h b/serd/serd.h
index aaf66549..a31d6e64 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -1004,6 +1004,13 @@ serd_env_foreach(const SerdEnv* env,
void* handle);
/**
+ Write all prefixes in `env` to `sink`.
+*/
+SERD_API
+void
+serd_env_write_prefixes(const SerdEnv* env, const SerdSink* sink);
+
+/**
@}
@name Sink
@{
diff --git a/src/env.c b/src/env.c
index da8d2a36..fa949acf 100644
--- a/src/env.c
+++ b/src/env.c
@@ -326,3 +326,12 @@ serd_env_foreach(const SerdEnv* env,
func(handle, env->prefixes[i].name, env->prefixes[i].uri);
}
}
+
+void
+serd_env_write_prefixes(const SerdEnv* env, const SerdSink* sink)
+{
+ for (size_t i = 0; i < env->n_prefixes; ++i) {
+ serd_sink_write_prefix(
+ sink, env->prefixes[i].name, env->prefixes[i].uri);
+ }
+}