diff options
author | David Robillard <d@drobilla.net> | 2018-05-12 13:01:10 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-13 19:15:32 +0200 |
commit | 75e8cb67f5082abdffd8941a5255be9a22dd9cb7 (patch) | |
tree | e7735b7b6d5a4257ac15114451db124ac0309e8b /src | |
parent | d9ec2146b45bd86a1cbfd0dcaf04e243d092aca9 (diff) | |
download | serd-75e8cb67f5082abdffd8941a5255be9a22dd9cb7.tar.gz serd-75e8cb67f5082abdffd8941a5255be9a22dd9cb7.tar.bz2 serd-75e8cb67f5082abdffd8941a5255be9a22dd9cb7.zip |
Avoid copying nodes when equivalent prefixes are set
Diffstat (limited to 'src')
-rw-r--r-- | src/env.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -120,9 +120,11 @@ serd_env_add(SerdEnv* env, const char* name_str = serd_node_get_string(name); SerdPrefix* const prefix = serd_env_find(env, name_str, name->n_bytes); if (prefix) { - SerdNode* old_prefix_uri = prefix->uri; - prefix->uri = serd_node_copy(uri); - serd_node_free(old_prefix_uri); + if (!serd_node_equals(prefix->uri, uri)) { + SerdNode* old_prefix_uri = prefix->uri; + prefix->uri = serd_node_copy(uri); + serd_node_free(old_prefix_uri); + } } else { env->prefixes = (SerdPrefix*)realloc( env->prefixes, (++env->n_prefixes) * sizeof(SerdPrefix)); |