aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-12-20 13:08:46 -0500
committerDavid Robillard <d@drobilla.net>2019-12-19 20:57:49 -0500
commitd9b65f7b0273795df2e4fb24afadc431477ad2dc (patch)
tree87f5565e01986e39250e51f36bdb53b9f4221226
parent918599ec2ddfc6d6b3afd6a13f46a7e5da0bd652 (diff)
downloadserd-d9b65f7b0273795df2e4fb24afadc431477ad2dc.tar.gz
serd-d9b65f7b0273795df2e4fb24afadc431477ad2dc.tar.bz2
serd-d9b65f7b0273795df2e4fb24afadc431477ad2dc.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 5c0d28b9..4e99e39f 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -1033,6 +1033,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 921413f7..dac6fdae 100644
--- a/src/env.c
+++ b/src/env.c
@@ -325,3 +325,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);
+ }
+}