diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/state.c | 8 | ||||
-rw-r--r-- | src/world.c | 13 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/state.c b/src/state.c index 9bc1d6d..137d1a7 100644 --- a/src/state.c +++ b/src/state.c @@ -1,5 +1,5 @@ /* - Copyright 2007-2015 David Robillard <http://drobilla.net> + Copyright 2007-2016 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -106,18 +106,18 @@ append_port_value(LilvState* state, uint32_t size, uint32_t type) { + PortValue* pv = NULL; if (value) { state->values = (PortValue*)realloc( state->values, (++state->n_values) * sizeof(PortValue)); - PortValue* pv = &state->values[state->n_values - 1]; + pv = &state->values[state->n_values - 1]; pv->symbol = lilv_strdup(port_symbol); pv->value = malloc(size); pv->size = size; pv->type = type; memcpy(pv->value, value, size); - return pv; } - return NULL; + return pv; } static const char* diff --git a/src/world.c b/src/world.c index b608261..d08e32d 100644 --- a/src/world.c +++ b/src/world.c @@ -335,15 +335,12 @@ lilv_lib_compare(const void* a, const void* b, void* user_data) static ZixTreeIter* lilv_collection_find_by_uri(const ZixTree* seq, const LilvNode* uri) { - if (!lilv_node_is_uri(uri)) { - return NULL; + ZixTreeIter* i = NULL; + if (lilv_node_is_uri(uri)) { + struct LilvHeader key = { NULL, (LilvNode*)uri }; + zix_tree_find(seq, &key, &i); } - - struct LilvHeader key = { NULL, (LilvNode*)uri }; - ZixTreeIter* i = NULL; - const ZixStatus st = zix_tree_find(seq, &key, &i); - - return st ? NULL : i; + return i; } /** Get an element of a collection of any object with an LilvHeader by URI. */ |