diff options
author | David Robillard <d@drobilla.net> | 2012-11-23 05:59:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-11-23 05:59:09 +0000 |
commit | 6ce5332b4e27d4fec3ed317386ea6839d217f7fd (patch) | |
tree | 2bef8a76b9c46bbe3491fcf268f9c1b3c08151dd /src/collections.c | |
parent | c28f70ab84dcbc2a185b1dc9577ea97cb1042701 (diff) | |
download | lilv-6ce5332b4e27d4fec3ed317386ea6839d217f7fd.tar.gz lilv-6ce5332b4e27d4fec3ed317386ea6839d217f7fd.tar.bz2 lilv-6ce5332b4e27d4fec3ed317386ea6839d217f7fd.zip |
Add lilv_nodes_merge() to API (address part of #835).
More lightweight version of lilv_plugin_has_feature() and lilv_world_find_nodes().
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4860 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/collections.c')
-rw-r--r-- | src/collections.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/collections.c b/src/collections.c index f7a035a..a4ac744 100644 --- a/src/collections.c +++ b/src/collections.c @@ -143,6 +143,25 @@ lilv_nodes_contains(const LilvNodes* list, const LilvNode* value) return false; } +LILV_API +LilvNodes* +lilv_nodes_merge(const LilvNodes* a, const LilvNodes* b) +{ + LilvNodes* result = lilv_nodes_new(); + + LILV_FOREACH(nodes, i, a) + zix_tree_insert((ZixTree*)result, + lilv_node_duplicate(lilv_nodes_get(a, i)), + NULL); + + LILV_FOREACH(nodes, i, b) + zix_tree_insert((ZixTree*)result, + lilv_node_duplicate(lilv_nodes_get(b, i)), + NULL); + + return result; +} + /* Iterator */ #define LILV_COLLECTION_IMPL(prefix, CT, ET) \ |