diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugin.c | 28 | ||||
-rw-r--r-- | src/pluginclass.c | 1 | ||||
-rw-r--r-- | src/pluginclasses.c | 1 | ||||
-rw-r--r-- | src/port.c | 9 | ||||
-rw-r--r-- | src/world.c | 2 |
5 files changed, 18 insertions, 23 deletions
diff --git a/src/plugin.c b/src/plugin.c index 6593029..870a32e 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -162,7 +162,6 @@ slv2_plugin_load(SLV2Plugin p) SLV2PluginClass plugin_class = slv2_plugin_classes_get_by_uri( p->world->plugin_classes, class); - librdf_free_node(class_node); @@ -539,17 +538,13 @@ void slv2_plugin_get_port_float_values(SLV2Plugin p, const char* qname, float* values) -{ - const unsigned char* query; - librdf_query* q; - librdf_query_results* results; - +{ slv2_plugin_load_if_necessary(p); for (int i = 0; i < raptor_sequence_size(p->ports); ++i) values[i] = NAN; - query = (const unsigned char*)slv2_strjoin( + unsigned char* query = (unsigned char*)slv2_strjoin( "PREFIX : <http://lv2plug.in/ns/lv2core#>\n" "SELECT DISTINCT ?index ?value WHERE {\n" "<> :port ?port .\n" @@ -557,10 +552,10 @@ slv2_plugin_get_port_float_values(SLV2Plugin p, "?port ", qname, " ?value .\n" "} ", NULL); - q = librdf_new_query(p->world->world, "sparql", + librdf_query* q = librdf_new_query(p->world->world, "sparql", NULL, query, slv2_value_as_librdf_uri(p->plugin_uri)); - results = librdf_query_execute(q, p->rdf); + librdf_query_results* results = librdf_query_execute(q, p->rdf); while (!librdf_query_results_finished(results)) { librdf_node* idx_node = librdf_query_results_get_binding_value(results, 0); @@ -578,6 +573,7 @@ slv2_plugin_get_port_float_values(SLV2Plugin p, librdf_free_query_results(results); librdf_free_query(q); + free(query); } @@ -666,7 +662,9 @@ slv2_plugin_get_latency_port_index(SLV2Plugin p) SLV2Value val = slv2_values_get_at(result, 0); assert(slv2_value_is_int(val)); - return slv2_value_as_int(val); + int ret = slv2_value_as_int(val); + slv2_values_free(result); + return ret; } @@ -691,11 +689,15 @@ slv2_plugin_get_supported_features(SLV2Plugin p) SLV2Values result = slv2_values_new(); unsigned n_optional = slv2_values_size(optional); + unsigned n_required = slv2_values_size(required); unsigned i = 0; for ( ; i < n_optional; ++i) - slv2_values_set_at(result, i, slv2_values_get_at(optional, i)); - for ( ; i < n_optional + slv2_values_size(required); ++i) - slv2_values_set_at(result, i, slv2_values_get_at(required, i - n_optional)); + slv2_values_set_at(result, i, raptor_sequence_pop(optional)); + for ( ; i < n_optional + n_required; ++i) + slv2_values_set_at(result, i, raptor_sequence_pop(required)); + + slv2_values_free(optional); + slv2_values_free(required); return result; } diff --git a/src/pluginclass.c b/src/pluginclass.c index 0ac9d05..6cc3bfe 100644 --- a/src/pluginclass.c +++ b/src/pluginclass.c @@ -39,7 +39,6 @@ slv2_plugin_class_new(SLV2World world, librdf_uri* parent_uri, librdf_uri* uri, } -/* private */ void slv2_plugin_class_free(SLV2PluginClass plugin_class) { diff --git a/src/pluginclasses.c b/src/pluginclasses.c index 3520359..1e7e69c 100644 --- a/src/pluginclasses.c +++ b/src/pluginclasses.c @@ -37,7 +37,6 @@ slv2_plugin_classes_new() void slv2_plugin_classes_free(SLV2PluginClasses list) { - //if (list != world->plugin_classes) if (list) raptor_free_sequence(list); } @@ -85,21 +85,16 @@ slv2_port_has_property(SLV2Plugin p, SLV2Value property) { assert(property); - - SLV2Values results = NULL; - char* query = slv2_strjoin( "SELECT DISTINCT ?port WHERE {\n" "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port ." "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n", " lv2:portProperty <", slv2_value_as_uri(property), "> .\n}", NULL); - results = slv2_plugin_query_variable(p, query, 0); - + SLV2Values results = slv2_plugin_query_variable(p, query, 0); const bool ret = (slv2_values_size(results) > 0); - + slv2_values_free(results); free(query); - free(results); return ret; } diff --git a/src/world.c b/src/world.c index f93b732..cd85e8e 100644 --- a/src/world.c +++ b/src/world.c @@ -137,7 +137,7 @@ slv2_world_free(SLV2World world) raptor_free_sequence(world->plugins); world->plugins = NULL; - slv2_plugin_classes_free(world->plugin_classes); + raptor_free_sequence(world->plugin_classes); world->plugin_classes = NULL; librdf_free_parser(world->parser); |