summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-30 02:07:42 +0000
committerDavid Robillard <d@drobilla.net>2011-04-30 02:07:42 +0000
commit6c72abfc6d6649f07d85f70b25ce4393dc775a39 (patch)
treed87d8cc347a43b3b02d97caa6666848448c7e92c /src
parent054c39b12cb610d79006f0b51153cb2c4aa5a0b7 (diff)
downloadlilv-6c72abfc6d6649f07d85f70b25ce4393dc775a39.tar.gz
lilv-6c72abfc6d6649f07d85f70b25ce4393dc775a39.tar.bz2
lilv-6c72abfc6d6649f07d85f70b25ce4393dc775a39.zip
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3241 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/collections.c8
-rw-r--r--src/instance.c7
-rw-r--r--src/lilv_internal.h10
-rw-r--r--src/node.c4
-rw-r--r--src/plugin.c11
-rw-r--r--src/port.c2
-rw-r--r--src/query.c12
-rw-r--r--src/world.c16
8 files changed, 39 insertions, 31 deletions
diff --git a/src/collections.c b/src/collections.c
index 0049d1f..74d10df 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -42,7 +42,10 @@ lilv_collection_size(const LilvCollection* coll)
LilvIter*
lilv_collection_begin(const LilvCollection* collection)
{
- return collection ? g_sequence_get_begin_iter((LilvCollection*)collection) : NULL;
+ if (collection) {
+ return g_sequence_get_begin_iter((LilvCollection*)collection);
+ }
+ return NULL;
}
void*
@@ -82,7 +85,8 @@ lilv_plugin_classes_new(void)
LILV_API
const LilvPluginClass*
-lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, const LilvNode* uri)
+lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll,
+ const LilvNode* uri)
{
return (LilvPluginClass*)lilv_sequence_get_by_uri(coll, uri);
}
diff --git a/src/instance.c b/src/instance.c
index 717bdb6..c9a5d83 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -37,8 +37,9 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
local_features[0] = NULL;
}
- const char* const lib_uri = lilv_node_as_uri(lilv_plugin_get_library_uri(plugin));
- const char* const lib_path = lilv_uri_to_path(lib_uri);
+ const LilvNode* const lib_uri_node = lilv_plugin_get_library_uri(plugin);
+ const char* const lib_uri = lilv_node_as_uri(lib_uri_node);
+ const char* const lib_path = lilv_uri_to_path(lib_uri);
if (!lib_path)
return NULL;
@@ -70,7 +71,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
LILV_ERRORF("Did not find plugin %s in %s\n",
lilv_node_as_uri(lilv_plugin_get_uri(plugin)), lib_path);
dlclose(lib);
- break; // return NULL
+ break; // return NULL
} else {
// Parse bundle URI to use as base URI
const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin);
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index c405a0d..c016eaf 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -159,7 +159,7 @@ typedef enum {
struct LilvNodeImpl {
LilvWorld* world;
- char* str_val; ///< always present
+ char* str_val; ///< always present
union {
int int_val;
float float_val;
@@ -194,7 +194,9 @@ LilvPort* lilv_port_new(LilvWorld* world,
const char* symbol);
void lilv_port_free(const LilvPlugin* plugin, LilvPort* port);
-LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri);
+LilvPlugin* lilv_plugin_new(LilvWorld* world,
+ LilvNode* uri,
+ LilvNode* bundle_uri);
void lilv_plugin_load_if_necessary(const LilvPlugin* p);
void lilv_plugin_free(LilvPlugin* plugin);
LilvNode* lilv_plugin_get_unique(const LilvPlugin* p,
@@ -233,7 +235,9 @@ LilvUI* lilv_ui_new(LilvWorld* world,
void lilv_ui_free(LilvUI* ui);
-LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val);
+LilvNode* lilv_node_new(LilvWorld* world,
+ LilvNodeType type,
+ const char* val);
LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node);
const SordNode* lilv_node_as_node(const LilvNode* value);
diff --git a/src/node.c b/src/node.c
index 8fbf5b1..d7ee26a 100644
--- a/src/node.c
+++ b/src/node.c
@@ -284,7 +284,7 @@ lilv_node_get_turtle_token(const LilvNode* value)
case LILV_VALUE_FLOAT:
// FIXME: locale kludge, need a locale independent snprintf
locale = lilv_strdup(setlocale(LC_NUMERIC, NULL));
- len = 20; // FIXME: proper maximum value?
+ len = 20; // FIXME: proper maximum value?
result = calloc(len, 1);
setlocale(LC_NUMERIC, "POSIX");
snprintf(result, len, "%f", value->val.float_val);
@@ -395,7 +395,7 @@ lilv_node_as_float(const LilvNode* value)
assert(lilv_node_is_float(value) || lilv_node_is_int(value));
if (lilv_node_is_float(value))
return value->val.float_val;
- else // lilv_node_is_int(value)
+ else // lilv_node_is_int(value)
return (float)value->val.int_val;
}
diff --git a/src/plugin.c b/src/plugin.c
index 25ae481..6bd2e78 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -249,7 +249,7 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p)
free(p->ports);
p->ports = NULL;
}
- break; // Invalid plugin
+ break; // Invalid plugin
}
}
lilv_match_end(ports);
@@ -337,8 +337,7 @@ lilv_plugin_get_class(const LilvPlugin* const_p)
}
LilvNode* class = lilv_node_new_from_node(p->world, class_node);
- if ( ! lilv_node_equals(class, p->world->lv2_plugin_class->uri)) {
-
+ if (!lilv_node_equals(class, p->world->lv2_plugin_class->uri)) {
const LilvPluginClass* plugin_class = lilv_plugin_classes_get_by_uri(
p->world->plugin_classes, class);
@@ -425,11 +424,11 @@ lilv_plugin_get_value_for_subject(const LilvPlugin* p,
const LilvNode* predicate)
{
lilv_plugin_load_ports_if_necessary(p);
- if ( ! lilv_node_is_uri(subject) && ! lilv_node_is_blank(subject)) {
+ if (!lilv_node_is_uri(subject) && !lilv_node_is_blank(subject)) {
LILV_ERROR("Subject is not a resource\n");
return NULL;
}
- if ( ! lilv_node_is_uri(predicate)) {
+ if (!lilv_node_is_uri(predicate)) {
LILV_ERROR("Predicate is not a URI\n");
return NULL;
}
@@ -501,7 +500,7 @@ lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
va_start(args, class_1);
bool matches = true;
- for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)) != NULL ; ) {
+ for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)); ) {
if (!lilv_port_is_a(p, port, class_i)) {
va_end(args);
matches = false;
diff --git a/src/port.c b/src/port.c
index b11980a..2161f0f 100644
--- a/src/port.c
+++ b/src/port.c
@@ -120,7 +120,7 @@ lilv_port_get_value(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* predicate)
{
- if ( ! lilv_node_is_uri(predicate)) {
+ if (!lilv_node_is_uri(predicate)) {
LILV_ERROR("Predicate is not a URI\n");
return NULL;
}
diff --git a/src/query.c b/src/query.c
index 1155e44..5f6cc57 100644
--- a/src/query.c
+++ b/src/query.c
@@ -24,9 +24,9 @@
#include "lilv_internal.h"
typedef enum {
- LILV_LANG_MATCH_NONE, ///< Language does not match at all
- LILV_LANG_MATCH_PARTIAL, ///< Partial (language, but not country) match
- LILV_LANG_MATCH_EXACT ///< Exact (language and country) match
+ LILV_LANG_MATCH_NONE, ///< Language does not match at all
+ LILV_LANG_MATCH_PARTIAL, ///< Partial (language, but not country) match
+ LILV_LANG_MATCH_EXACT ///< Exact (language and country) match
} LilvLangMatch;
static LilvLangMatch
@@ -57,9 +57,9 @@ LilvNodes*
lilv_nodes_from_stream_objects_i18n(LilvWorld* world,
SordIter* stream)
{
- LilvNodes* values = lilv_nodes_new();
- const SordNode* nolang = NULL; // Untranslated value
- const SordNode* partial = NULL; // Partial language match
+ LilvNodes* values = lilv_nodes_new();
+ const SordNode* nolang = NULL; // Untranslated value
+ const SordNode* partial = NULL; // Partial language match
char* syslang = lilv_get_lang();
FOREACH_MATCH(stream) {
const SordNode* value = lilv_match_object(stream);
diff --git a/src/world.c b/src/world.c
index 336970f..edd9bd1 100644
--- a/src/world.c
+++ b/src/world.c
@@ -56,8 +56,8 @@ lilv_world_new(void)
world->plugin_classes = lilv_plugin_classes_new();
world->plugins = lilv_plugins_new();
-#define NS_DYNMAN (const uint8_t*)"http://lv2plug.in/ns/ext/dynmanifest#"
-#define NS_DC (const uint8_t*)"http://dublincore.org/documents/dcmi-namespace/"
+#define NS_DYNMAN "http://lv2plug.in/ns/ext/dynmanifest#"
+#define NS_DC "http://dublincore.org/documents/dcmi-namespace/"
#define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)uri)
#define NEW_URI_VAL(uri) lilv_new_uri(world, (const char*)(uri));
@@ -96,11 +96,11 @@ lilv_world_new(void)
assert(world->lv2_plugin_class);
world->namespaces = serd_env_new();
- lilv_world_set_prefix(world, "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
- lilv_world_set_prefix(world, "rdfs", "http://www.w3.org/2000/01/rdf-schema#");
- lilv_world_set_prefix(world, "doap", "http://usefulinc.com/ns/doap#");
- lilv_world_set_prefix(world, "foaf", "http://xmlns.com/foaf/0.1/");
- lilv_world_set_prefix(world, "lv2", "http://lv2plug.in/ns/lv2core#");
+ lilv_world_set_prefix(world, "rdf", LILV_NS_RDF);
+ lilv_world_set_prefix(world, "rdfs", LILV_NS_RDFS);
+ lilv_world_set_prefix(world, "doap", LILV_NS_DOAP);
+ lilv_world_set_prefix(world, "foaf", LILV_NS_FOAF);
+ lilv_world_set_prefix(world, "lv2", LILV_NS_LV2);
lilv_world_set_prefix(world, "lv2ev", "http://lv2plug.in/ns/ext/event#");
world->n_read_files = 0;
@@ -474,7 +474,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
dlclose(lib);
}
lilv_match_end(dmanifests);
-#endif // LILV_DYN_MANIFEST
+#endif // LILV_DYN_MANIFEST
}
LILV_API