summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-29 23:38:18 +0000
committerDavid Robillard <d@drobilla.net>2011-01-29 23:38:18 +0000
commit801876c89ef1e4dcd16f5c5f9c29416b78ac15c4 (patch)
tree7d5213af6e779033d591cd2ad093558a1f99a824 /src/plugin.c
parent1c040fd172230496d655ddce6033e8daa9ffa023 (diff)
downloadlilv-801876c89ef1e4dcd16f5c5f9c29416b78ac15c4.tar.gz
lilv-801876c89ef1e4dcd16f5c5f9c29416b78ac15c4.tar.bz2
lilv-801876c89ef1e4dcd16f5c5f9c29416b78ac15c4.zip
Use consistent (and terser) for loop idiom for iterating over librdf streams.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2860 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 716e321..08e873c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -123,15 +123,13 @@ slv2_plugin_query_node(SLV2Plugin p, librdf_node* subject, librdf_node* predicat
}
SLV2Values result = slv2_values_new();
- while (!librdf_stream_end(results)) {
+ for (; !librdf_stream_end(results); librdf_stream_next(results)) {
librdf_statement* s = librdf_stream_get_object(results);
librdf_node* value_node = librdf_statement_get_object(s);
SLV2Value value = slv2_value_new_librdf_node(p->world, value_node);
if (value)
raptor_sequence_push(result, value);
-
- librdf_stream_next(results);
}
librdf_free_stream(results);
@@ -184,7 +182,7 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p)
librdf_new_node_from_node(p->world->lv2_port_node),
NULL);
- while (!librdf_stream_end(ports)) {
+ for (; !librdf_stream_end(ports); librdf_stream_next(ports)) {
librdf_statement* s = librdf_stream_get_object(ports);
librdf_node* port = librdf_statement_get_object(s);
@@ -234,7 +232,7 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p)
librdf_new_node_from_node(port),
librdf_new_node_from_node(p->world->rdf_a_node),
NULL);
- while (!librdf_stream_end(types)) {
+ for (; !librdf_stream_end(types); librdf_stream_next(types)) {
librdf_node* type = librdf_statement_get_object(
librdf_stream_get_object(types));
if (librdf_node_is_resource(type)) {
@@ -244,7 +242,6 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p)
} else {
SLV2_WARN("port has non-URI rdf:type\n");
}
- librdf_stream_next(types);
}
librdf_free_stream(types);
@@ -259,8 +256,6 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p)
p->ports = NULL;
}
break; // Invalid plugin
- } else {
- librdf_stream_next(ports);
}
}
librdf_free_stream(ports);
@@ -353,7 +348,7 @@ slv2_plugin_get_library_uri(SLV2Plugin p)
librdf_new_node_from_uri(p->world->world, p->plugin_uri->val.uri_val),
librdf_new_node_from_node(p->world->lv2_binary_node),
NULL);
- while (!librdf_stream_end(results)) {
+ for (; !librdf_stream_end(results); librdf_stream_next(results)) {
librdf_statement* s = librdf_stream_get_object(results);
librdf_node* binary_node = librdf_statement_get_object(s);
librdf_uri* binary_uri = librdf_node_get_uri(binary_node);
@@ -362,8 +357,6 @@ slv2_plugin_get_library_uri(SLV2Plugin p)
p->binary_uri = slv2_value_new_librdf_uri(p->world, binary_uri);
break;
}
-
- librdf_stream_next(results);
}
librdf_free_stream(results);
}
@@ -389,13 +382,12 @@ slv2_plugin_get_class(SLV2Plugin p)
librdf_new_node_from_uri(p->world->world, p->plugin_uri->val.uri_val),
librdf_new_node_from_node(p->world->rdf_a_node),
NULL);
- while (!librdf_stream_end(results)) {
+ for (; !librdf_stream_end(results); librdf_stream_next(results)) {
librdf_statement* s = librdf_stream_get_object(results);
librdf_node* class_node = librdf_new_node_from_node(librdf_statement_get_object(s));
librdf_uri* class_uri = librdf_node_get_uri(class_node);
if (!class_uri) {
- librdf_stream_next(results);
continue;
}
@@ -416,7 +408,6 @@ slv2_plugin_get_class(SLV2Plugin p)
}
slv2_value_free(class);
- librdf_stream_next(results);
}
if (p->plugin_class == NULL)