summaryrefslogtreecommitdiffstats
path: root/src/pluginclass.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-11 18:15:18 +0000
committerDavid Robillard <d@drobilla.net>2011-02-11 18:15:18 +0000
commit4861238c1624a193e30fc0aa78438b4977dbeb82 (patch)
tree3a740862ccb973833e4c2638010d4bbe00ac0a67 /src/pluginclass.c
parent9749ab338c735f777be4fe6dc89082ea30044df1 (diff)
downloadlilv-4861238c1624a193e30fc0aa78438b4977dbeb82.tar.gz
lilv-4861238c1624a193e30fc0aa78438b4977dbeb82.tar.bz2
lilv-4861238c1624a193e30fc0aa78438b4977dbeb82.zip
Use GSequence for collections with get_by_uri search methods.
Avoid constant sorting during plugin discovery. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2919 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/pluginclass.c')
-rw-r--r--src/pluginclass.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 27486ea..4aef8f4 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -85,14 +85,16 @@ SLV2PluginClasses
slv2_plugin_class_get_children(SLV2PluginClass plugin_class)
{
// Returned list doesn't own categories
- SLV2PluginClasses result = g_ptr_array_new();
+ SLV2PluginClasses all = plugin_class->world->plugin_classes;
+ SLV2PluginClasses result = g_sequence_new(NULL);
- for (unsigned i = 0; i < ((GPtrArray*)plugin_class->world->plugin_classes)->len; ++i) {
- SLV2PluginClass c = g_ptr_array_index(
- (GPtrArray*)plugin_class->world->plugin_classes, i);
- SLV2Value parent = slv2_plugin_class_get_parent_uri(c);
+ for (GSequenceIter* i = g_sequence_get_begin_iter(all);
+ i != g_sequence_get_end_iter(all);
+ i = g_sequence_iter_next(i)) {
+ SLV2PluginClass c = g_sequence_get(i);
+ SLV2Value parent = slv2_plugin_class_get_parent_uri(c);
if (parent && slv2_value_equals(slv2_plugin_class_get_uri(plugin_class), parent))
- g_ptr_array_add(result, c);
+ slv2_sequence_insert(result, c);
}
return result;