From 6ce5332b4e27d4fec3ed317386ea6839d217f7fd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Nov 2012 05:59:09 +0000 Subject: 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 --- src/collections.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/collections.c') 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) \ -- cgit v1.2.1