summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugin.c21
-rw-r--r--src/pluginclass.c14
-rw-r--r--src/pluginclasses.c6
-rw-r--r--src/plugins.c2
-rw-r--r--src/pluginuis.c2
-rw-r--r--src/slv2_internal.h5
-rw-r--r--src/world.c18
7 files changed, 34 insertions, 34 deletions
diff --git a/src/plugin.c b/src/plugin.c
index b6789c6..73a3ebf 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -163,27 +163,30 @@ slv2_plugin_load(SLV2Plugin p)
NULL, query, p->plugin_uri);
librdf_query_results* results = librdf_query_execute(q, p->rdf);
-
+
while (!librdf_query_results_finished(results)) {
librdf_node* class_node = librdf_query_results_get_binding_value(results, 0);
librdf_uri* class_uri = librdf_node_get_uri(class_node);
const char* class_uri_str = (const char*)librdf_uri_as_string(class_uri);
- SLV2PluginClass plugin_class = slv2_plugin_classes_get_by_uri(
- p->world->plugin_classes, class_uri_str);
-
- librdf_free_node(class_node);
+ if ( ! librdf_uri_equals(class_uri, p->world->lv2_plugin_class->uri) ) {
+
+ SLV2PluginClass plugin_class = slv2_plugin_classes_get_by_uri(
+ p->world->plugin_classes, class_uri_str);
+
+ librdf_free_node(class_node);
- if (plugin_class) {
- p->plugin_class = plugin_class;
- break;
+ if (plugin_class) {
+ p->plugin_class = plugin_class;
+ break;
+ }
}
librdf_query_results_next(results);
}
if (p->plugin_class == NULL)
- p->plugin_class = raptor_sequence_get_at(p->world->plugin_classes, 0); // lv2:Plugin
+ p->plugin_class = p->world->lv2_plugin_class;
librdf_free_query_results(results);
librdf_free_query(q);
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 6a71680..c41ce79 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -25,15 +25,15 @@
SLV2PluginClass
-slv2_plugin_class_new(SLV2World world, const char* parent_uri, const char* uri, const char* label)
+slv2_plugin_class_new(SLV2World world, const char* parent_uri, const char* uri, const char* label)
{
SLV2PluginClass plugin_class = (SLV2PluginClass)malloc(sizeof(struct _SLV2PluginClass));
plugin_class->world = world;
if (parent_uri)
- plugin_class->parent_uri = strdup(parent_uri);
+ plugin_class->parent_uri = librdf_new_uri(world->world, (const unsigned char*)parent_uri);
else
plugin_class->parent_uri = NULL;
- plugin_class->uri = strdup(uri);
+ plugin_class->uri = librdf_new_uri(world->world, (const unsigned char*)uri);
plugin_class->label = strdup(label);
return plugin_class;
}
@@ -42,8 +42,8 @@ slv2_plugin_class_new(SLV2World world, const char* parent_uri, const char* uri,
void
slv2_plugin_class_free(SLV2PluginClass plugin_class)
{
- free(plugin_class->uri);
- free(plugin_class->parent_uri);
+ librdf_free_uri(plugin_class->uri);
+ librdf_free_uri(plugin_class->parent_uri);
free(plugin_class->label);
free(plugin_class);
}
@@ -52,14 +52,14 @@ slv2_plugin_class_free(SLV2PluginClass plugin_class)
const char*
slv2_plugin_class_get_parent_uri(SLV2PluginClass plugin_class)
{
- return plugin_class->parent_uri;
+ return (const char*)librdf_uri_as_string(plugin_class->parent_uri);
}
const char*
slv2_plugin_class_get_uri(SLV2PluginClass plugin_class)
{
- return plugin_class->uri;
+ return (const char*)librdf_uri_as_string(plugin_class->uri);
}
diff --git a/src/pluginclasses.c b/src/pluginclasses.c
index 1b578f1..26c56d2 100644
--- a/src/pluginclasses.c
+++ b/src/pluginclasses.c
@@ -63,9 +63,9 @@ slv2_plugin_classes_get_by_uri(SLV2PluginClasses list, const char* uri)
i = lower + ((upper - lower) / 2);
SLV2PluginClass p = raptor_sequence_get_at(list, i);
-
- int cmp = strcmp(slv2_plugin_class_get_uri(p), uri);
-
+
+ const int cmp = strcmp(slv2_plugin_class_get_uri(p), uri);
+
if (cmp == 0)
return p;
else if (cmp > 0)
diff --git a/src/plugins.c b/src/plugins.c
index 9d3214e..d3b7bde 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -286,7 +286,7 @@ slv2_plugins_get_by_uri(SLV2Plugins list, const char* uri)
SLV2Plugin p = raptor_sequence_get_at(list, i);
- int cmp = strcmp(slv2_plugin_get_uri(p), uri);
+ const int cmp = strcmp(slv2_plugin_get_uri(p), uri);
if (cmp == 0)
return p;
diff --git a/src/pluginuis.c b/src/pluginuis.c
index bc4b66b..2fe5c71 100644
--- a/src/pluginuis.c
+++ b/src/pluginuis.c
@@ -67,7 +67,7 @@ slv2_uis_get_by_uri(SLV2UIs list, const char* uri)
SLV2UI ui = raptor_sequence_get_at(list, i);
- int cmp = strcmp(slv2_ui_get_uri(ui), uri);
+ const int cmp = strcmp(slv2_ui_get_uri(ui), uri);
if (cmp == 0)
return ui;
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index 6aba9de..2f66670 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -112,8 +112,8 @@ struct _SLV2UIInstanceImpl {
struct _SLV2PluginClass {
struct _SLV2World* world;
- char* parent_uri;
- char* uri;
+ librdf_uri* parent_uri;
+ librdf_uri* uri;
char* label;
};
@@ -141,6 +141,7 @@ struct _SLV2World {
librdf_storage* storage;
librdf_model* model;
librdf_parser* parser;
+ SLV2PluginClass lv2_plugin_class;
SLV2PluginClasses plugin_classes;
SLV2Plugins plugins;
librdf_node* lv2_specification_node;
diff --git a/src/world.c b/src/world.c
index 052dadf..fe7bbbf 100644
--- a/src/world.c
+++ b/src/world.c
@@ -56,12 +56,10 @@ slv2_world_new()
if (!world->parser)
goto fail;
- world->plugin_classes = slv2_plugin_classes_new();
-
- // Add the ever-present lv2:Plugin to classes
static const char* lv2_plugin_uri = "http://lv2plug.in/ns/lv2core#Plugin";
- raptor_sequence_push(world->plugin_classes, slv2_plugin_class_new(
- world, NULL, lv2_plugin_uri, "Plugin"));
+ world->lv2_plugin_class = slv2_plugin_class_new(world, NULL, lv2_plugin_uri, "Plugin");
+
+ world->plugin_classes = slv2_plugin_classes_new();
world->plugins = slv2_plugins_new();
@@ -106,12 +104,10 @@ slv2_world_new_using_rdf_world(librdf_world* rdf_world)
if (!world->parser)
goto fail;
- world->plugin_classes = slv2_plugin_classes_new();
-
- // Add the ever-present lv2:Plugin to classes
static const char* lv2_plugin_uri = "http://lv2plug.in/ns/lv2core#Plugin";
- raptor_sequence_push(world->plugin_classes, slv2_plugin_class_new(
- world, NULL, lv2_plugin_uri, "Plugin"));
+ world->lv2_plugin_class = slv2_plugin_class_new(world, NULL, lv2_plugin_uri, "Plugin");
+
+ world->plugin_classes = slv2_plugin_classes_new();
world->plugins = slv2_plugins_new();
@@ -563,7 +559,7 @@ slv2_world_serialize(const char* filename)
SLV2PluginClass
slv2_world_get_plugin_class(SLV2World world)
{
- return raptor_sequence_get_at(world->plugin_classes, 0);
+ return world->lv2_plugin_class;
}