summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugin.c4
-rw-r--r--src/slv2_internal.h3
-rw-r--r--src/world.c35
-rw-r--r--utils/lv2_inspect.c1
4 files changed, 29 insertions, 14 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 1b6f3de..26168e2 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -195,9 +195,7 @@ slv2_plugin_load(SLV2Plugin p)
if (!p->storage) {
assert(!p->rdf);
- p->storage = librdf_new_storage(p->world->world, "trees", NULL, NULL);
- if (!p->storage)
- p->storage = librdf_new_storage(p->world->world, "memory", NULL, NULL);
+ p->storage = slv2_world_new_storage(p->world);
p->rdf = librdf_new_model(p->world->world, p->storage, NULL);
}
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index 1601a4d..20fe619 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -165,6 +165,9 @@ slv2_world_load_specifications(SLV2World world);
void
slv2_world_load_file(SLV2World world, librdf_uri* file_uri);
+librdf_storage*
+slv2_world_new_storage(SLV2World world);
+
/* ********* Plugin UI ********* */
diff --git a/src/world.c b/src/world.c
index bd38fd2..f0022ed 100644
--- a/src/world.c
+++ b/src/world.c
@@ -42,14 +42,7 @@ slv2_world_new_internal(SLV2World world)
assert(world);
assert(world->world);
- world->storage = librdf_new_storage(world->world, "trees", NULL, NULL);
- if (!world->storage) {
- SLV2_WARN("Warning: Unable to create \"trees\" RDF storage.\n"
- "Performance can be improved by upgrading librdf.\n");
- world->storage = librdf_new_storage(world->world, "hashes", NULL,
- "hash-type='memory'");
- }
-
+ world->storage = slv2_world_new_storage(world);
if (!world->storage)
goto fail;
@@ -91,6 +84,28 @@ fail:
}
+/* private */
+librdf_storage*
+slv2_world_new_storage(SLV2World world)
+{
+ static bool warned = false;
+ librdf_hash* options = librdf_new_hash_from_string(world->world, NULL,
+ "index-spo='yes',index-ops='yes'");
+ librdf_storage* ret = librdf_new_storage_with_options(
+ world->world, "trees", NULL, options);
+ if (!ret) {
+ warned = true;
+ SLV2_WARN("Warning: Unable to create \"trees\" RDF storage.\n"
+ "Performance can be improved by upgrading librdf.\n");
+ ret = librdf_new_storage(world->world, "hashes", NULL,
+ "hash-type='memory'");
+ }
+
+ librdf_free_hash(options);
+ return ret;
+}
+
+
SLV2World
slv2_world_new()
{
@@ -185,9 +200,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
bundle_uri->val.uri_val, (const unsigned char*)"manifest.ttl");
/* Parse the manifest into a temporary model */
- librdf_storage* manifest_storage = librdf_new_storage(world->world, "trees", NULL, NULL);
- if (manifest_storage == NULL)
- manifest_storage = librdf_new_storage(world->world, "memory", NULL, NULL);
+ librdf_storage* manifest_storage = slv2_world_new_storage(world);
librdf_model* manifest_model = librdf_new_model(world->world,
manifest_storage, NULL);
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index 7b3d594..716d9a2 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -226,6 +226,7 @@ SELECT ?name WHERE { <> lv2p:hasPreset ?preset . ?preset dc:title ?name }");
for (; !slv2_results_finished(presets); slv2_results_next(presets)) {
SLV2Value name = slv2_results_get_binding_value(presets, 0);
printf("\t %s\n", slv2_value_as_string(name));
+ slv2_value_free(name);
}
slv2_results_free(presets);