diff options
author | David Robillard <d@drobilla.net> | 2018-12-30 12:35:47 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 18b0689fe567929b6eb6a1986b16139a122ca12c (patch) | |
tree | a5252c5a2ed6d1aaa5d9371c20a54c26746a38fb | |
parent | f58e9a1cd558de40efaa26a0a6e58ae5c61bbcfc (diff) | |
download | serd-18b0689fe567929b6eb6a1986b16139a122ca12c.tar.gz serd-18b0689fe567929b6eb6a1986b16139a122ca12c.tar.bz2 serd-18b0689fe567929b6eb6a1986b16139a122ca12c.zip |
Remove serd_env_foreach()
This is not particularly useful except to write prefixes, which is what
serd_env_write_prefixes is for, and the name implies that namespace prefixes
are the only thing in an Env, which will be problematic in the future.
-rw-r--r-- | serd/serd.h | 9 | ||||
-rw-r--r-- | src/env.c | 10 | ||||
-rw-r--r-- | tests/env_test.c | 6 |
3 files changed, 4 insertions, 21 deletions
diff --git a/serd/serd.h b/serd/serd.h index 93c6274b..bb68f21f 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1024,15 +1024,6 @@ SerdNode* serd_env_expand(const SerdEnv* env, const SerdNode* node); /** - Call `func` for each prefix defined in `env`. -*/ -SERD_API -void -serd_env_foreach(const SerdEnv* env, - SerdPrefixSink func, - void* handle); - -/** Write all prefixes in `env` to `sink`. */ SERD_API @@ -318,16 +318,6 @@ serd_env_expand(const SerdEnv* env, const SerdNode* node) } void -serd_env_foreach(const SerdEnv* env, - SerdPrefixSink func, - void* handle) -{ - for (size_t i = 0; i < env->n_prefixes; ++i) { - 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) { diff --git a/tests/env_test.c b/tests/env_test.c index d80eb1f8..b636048b 100644 --- a/tests/env_test.c +++ b/tests/env_test.c @@ -85,9 +85,11 @@ test_env(void) assert(!serd_env_expand(env, blank)); serd_node_free(blank); - int n_prefixes = 0; + size_t n_prefixes = 0; + SerdSink* count_prefixes_sink = serd_sink_new(&n_prefixes); + serd_sink_set_prefix_func(count_prefixes_sink, count_prefixes); serd_env_set_prefix(env, pre, eg); - serd_env_foreach(env, count_prefixes, &n_prefixes); + serd_env_write_prefixes(env, count_prefixes_sink); assert(n_prefixes == 1); SerdNode* shorter_uri = serd_new_uri("urn:foo"); |