summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-07-31 04:15:58 +0000
committerDavid Robillard <d@drobilla.net>2014-07-31 04:15:58 +0000
commit99eca3f240998654e0adb3263dee93a19a4dc4b2 (patch)
tree5937f3a135dcd865cea06e6d37671fc6be50b85a /src
parent45f02a1390bbea3f7acbef5fdb4807a9f9331f3d (diff)
downloadlilv-99eca3f240998654e0adb3263dee93a19a4dc4b2.tar.gz
lilv-99eca3f240998654e0adb3263dee93a19a4dc4b2.tar.bz2
lilv-99eca3f240998654e0adb3263dee93a19a4dc4b2.zip
Minor code cleanups, slightly reduce LOC.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5416 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/collections.c35
-rw-r--r--src/instance.c6
-rw-r--r--src/lilv_internal.h19
-rw-r--r--src/node.c96
-rw-r--r--src/plugin.c175
-rw-r--r--src/pluginclass.c24
-rw-r--r--src/port.c77
-rw-r--r--src/scalepoint.c11
-rw-r--r--src/state.c39
-rw-r--r--src/ui.c31
-rw-r--r--src/world.c160
11 files changed, 240 insertions, 433 deletions
diff --git a/src/collections.c b/src/collections.c
index 6a3488b..6437c3e 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -54,10 +54,7 @@ lilv_collection_size(const LilvCollection* coll)
LilvIter*
lilv_collection_begin(const LilvCollection* collection)
{
- if (collection) {
- return (LilvIter*)zix_tree_begin((ZixTree*)collection);
- }
- return NULL;
+ return collection ? (LilvIter*)zix_tree_begin((ZixTree*)collection) : NULL;
}
void*
@@ -99,8 +96,7 @@ lilv_plugin_classes_new(void)
/* URI based accessors (for collections of things with URIs) */
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll,
const LilvNode* uri)
{
@@ -108,8 +104,7 @@ lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll,
(const ZixTree*)coll, uri);
}
-LILV_API
-const LilvUI*
+LILV_API const LilvUI*
lilv_uis_get_by_uri(const LilvUIs* coll, const LilvNode* uri)
{
return (LilvUI*)lilv_collection_get_by_uri((const ZixTree*)coll, uri);
@@ -123,8 +118,7 @@ lilv_plugins_new(void)
return lilv_collection_new(lilv_header_compare_by_uri, NULL);
}
-LILV_API
-const LilvPlugin*
+LILV_API const LilvPlugin*
lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri)
{
return (LilvPlugin*)lilv_collection_get_by_uri((const ZixTree*)list, uri);
@@ -132,8 +126,7 @@ lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri)
/* Nodes */
-LILV_API
-bool
+LILV_API bool
lilv_nodes_contains(const LilvNodes* list, const LilvNode* value)
{
LILV_FOREACH(nodes, i, list)
@@ -143,8 +136,7 @@ lilv_nodes_contains(const LilvNodes* list, const LilvNode* value)
return false;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_nodes_merge(const LilvNodes* a, const LilvNodes* b)
{
LilvNodes* result = lilv_nodes_new();
@@ -201,32 +193,27 @@ LILV_COLLECTION_IMPL(lilv_uis, LilvUIs, LilvUI)
LILV_COLLECTION_IMPL(lilv_nodes, LilvNodes, LilvNode)
LILV_COLLECTION_IMPL(lilv_plugins, LilvPlugins, LilvPlugin)
-LILV_API
-void
+LILV_API void
lilv_plugin_classes_free(LilvPluginClasses* collection) {
lilv_collection_free(collection);
}
-LILV_API
-void
+LILV_API void
lilv_scale_points_free(LilvScalePoints* collection) {
lilv_collection_free(collection);
}
-LILV_API
-void
+LILV_API void
lilv_uis_free(LilvUIs* collection) {
lilv_collection_free(collection);
}
-LILV_API
-void
+LILV_API void
lilv_nodes_free(LilvNodes* collection) {
lilv_collection_free(collection);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_nodes_get_first(const LilvNodes* collection) {
return (LilvNode*)lilv_collection_get(collection,
lilv_collection_begin(collection));
diff --git a/src/instance.c b/src/instance.c
index ea109d5..21f3d03 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -21,8 +21,7 @@
#include "lilv_internal.h"
-LILV_API
-LilvInstance*
+LILV_API LilvInstance*
lilv_plugin_instantiate(const LilvPlugin* plugin,
double sample_rate,
const LV2_Feature*const* features)
@@ -110,8 +109,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
return result;
}
-LILV_API
-void
+LILV_API void
lilv_instance_free(LilvInstance* instance)
{
if (!instance)
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index f078084..9e9de2f 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -29,11 +29,11 @@ extern "C" {
#ifdef _WIN32
# include <windows.h>
# define dlopen(path, flags) LoadLibrary(path)
-# define dlclose(lib) FreeLibrary((HMODULE)lib)
+# define dlclose(lib) FreeLibrary((HMODULE)lib)
# ifdef _MSC_VER
# define __func__ __FUNCTION__
# define INFINITY DBL_MAX + DBL_MAX
-# define NAN INFINITY - INFINITY
+# define NAN INFINITY - INFINITY
# define snprintf _snprintf
# endif
static inline char* dlerror(void) { return "Unknown error"; }
@@ -293,21 +293,14 @@ 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_from_node(LilvWorld* world,
- const SordNode* node);
-const SordNode* lilv_node_as_node(const LilvNode* value);
+LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val);
+LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node);
int lilv_header_compare_by_uri(const void* a, const void* b, void* user_data);
int lilv_lib_compare(const void* a, const void* b, void* user_data);
-int
-lilv_ptr_cmp(const void* a, const void* b, void* user_data);
-
-int
-lilv_resource_node_cmp(const void* a, const void* b, void* user_data);
+int lilv_ptr_cmp(const void* a, const void* b, void* user_data);
+int lilv_resource_node_cmp(const void* a, const void* b, void* user_data);
struct LilvHeader*
lilv_collection_get_by_uri(const ZixTree* seq, const LilvNode* uri);
diff --git a/src/node.c b/src/node.c
index 3d074a4..c771e40 100644
--- a/src/node.c
+++ b/src/node.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2011 David Robillard <http://drobilla.net>
+ Copyright 2007-2014 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -147,15 +147,13 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
return result;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_uri(LilvWorld* world, const char* uri)
{
return lilv_node_new(world, LILV_VALUE_URI, uri);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_file_uri(LilvWorld* world, const char* host, const char* path)
{
char* abs_path = lilv_path_absolute(path);
@@ -168,15 +166,13 @@ lilv_new_file_uri(LilvWorld* world, const char* host, const char* path)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_string(LilvWorld* world, const char* str)
{
return lilv_node_new(world, LILV_VALUE_STRING, str);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_int(LilvWorld* world, int val)
{
char str[32];
@@ -186,8 +182,7 @@ lilv_new_int(LilvWorld* world, int val)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_float(LilvWorld* world, float val)
{
char str[32];
@@ -197,8 +192,7 @@ lilv_new_float(LilvWorld* world, float val)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_bool(LilvWorld* world, bool val)
{
LilvNode* ret = lilv_node_new(world, LILV_VALUE_BOOL,
@@ -207,8 +201,7 @@ lilv_new_bool(LilvWorld* world, bool val)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_node_duplicate(const LilvNode* val)
{
if (!val) {
@@ -223,8 +216,7 @@ lilv_node_duplicate(const LilvNode* val)
return result;
}
-LILV_API
-void
+LILV_API void
lilv_node_free(LilvNode* val)
{
if (val) {
@@ -233,8 +225,7 @@ lilv_node_free(LilvNode* val)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_node_equals(const LilvNode* value, const LilvNode* other)
{
if (value == NULL && other == NULL)
@@ -261,8 +252,7 @@ lilv_node_equals(const LilvNode* value, const LilvNode* other)
return false; /* shouldn't get here */
}
-LILV_API
-char*
+LILV_API char*
lilv_node_get_turtle_token(const LilvNode* value)
{
const char* str = (const char*)sord_node_get_string(value->node);
@@ -299,45 +289,35 @@ lilv_node_get_turtle_token(const LilvNode* value)
return result;
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_uri(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_URI);
}
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_uri(const LilvNode* value)
{
- assert(!value || lilv_node_is_uri(value));
- return value ? (const char*)sord_node_get_string(value->node) : NULL;
-}
-
-const SordNode*
-lilv_node_as_node(const LilvNode* value)
-{
- assert(lilv_node_is_uri(value));
- return value->node;
+ return (lilv_node_is_uri(value)
+ ? (const char*)sord_node_get_string(value->node)
+ : NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_blank(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_BLANK);
}
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_blank(const LilvNode* value)
{
- assert(!value || lilv_node_is_blank(value));
- return value ? (const char*)sord_node_get_string(value->node) : NULL;
+ return (lilv_node_is_blank(value)
+ ? (const char*)sord_node_get_string(value->node)
+ : NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_literal(const LilvNode* value)
{
if (!value)
@@ -353,45 +333,37 @@ lilv_node_is_literal(const LilvNode* value)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_string(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_STRING);
}
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_string(const LilvNode* value)
{
return value ? (const char*)sord_node_get_string(value->node) : NULL;
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_int(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_INT);
}
-LILV_API
-int
+LILV_API int
lilv_node_as_int(const LilvNode* value)
{
- assert(value);
- assert(lilv_node_is_int(value));
- return value->val.int_val;
+ return lilv_node_is_int(value) ? value->val.int_val : 0;
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_float(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_FLOAT);
}
-LILV_API
-float
+LILV_API float
lilv_node_as_float(const LilvNode* value)
{
assert(lilv_node_is_float(value) || lilv_node_is_int(value));
@@ -402,18 +374,14 @@ lilv_node_as_float(const LilvNode* value)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_bool(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_BOOL);
}
-LILV_API
-bool
+LILV_API bool
lilv_node_as_bool(const LilvNode* value)
{
- assert(value);
- assert(lilv_node_is_bool(value));
- return value->val.bool_val;
+ return lilv_node_is_bool(value) ? value->val.bool_val : false;
}
diff --git a/src/plugin.c b/src/plugin.c
index 2f9e5b8..0d97290 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -207,12 +207,11 @@ lilv_plugin_load(LilvPlugin* p)
static bool
is_symbol(const char* str)
{
- const size_t len = strlen(str);
- for (size_t i = 0; i < len; ++i) {
- if (!((str[i] >= 'a' && str[i] <= 'z')
- || (str[i] >= 'A' && str[i] <= 'Z')
- || (i > 0 && str[i] >= '0' && str[i] <= '9')
- || str[i] == '_')) {
+ for (const char* s = str; *s; ++s) {
+ if (!((*s >= 'a' && *s <= 'z') ||
+ (*s >= 'A' && *s <= 'Z') ||
+ (s > str && *s >= '0' && *s <= '9') ||
+ *s == '_')) {
return false;
}
}
@@ -325,45 +324,37 @@ lilv_plugin_load_if_necessary(const LilvPlugin* p)
lilv_plugin_load((LilvPlugin*)p);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_uri(const LilvPlugin* p)
{
- assert(p);
- assert(p->plugin_uri);
return p->plugin_uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_bundle_uri(const LilvPlugin* p)
{
- assert(p);
- assert(p->bundle_uri);
return p->bundle_uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_library_uri(const LilvPlugin* const_p)
{
LilvPlugin* p = (LilvPlugin*)const_p;
lilv_plugin_load_if_necessary(p);
if (!p->binary_uri) {
// <plugin> lv2:binary ?binary
- SordIter* results = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- p->world->uris.lv2_binary,
- NULL);
- FOREACH_MATCH(results) {
- const SordNode* binary_node = sord_iter_get_node(results, SORD_OBJECT);
+ SordIter* i = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ p->world->uris.lv2_binary,
+ NULL);
+ FOREACH_MATCH(i) {
+ const SordNode* binary_node = sord_iter_get_node(i, SORD_OBJECT);
if (sord_node_get_type(binary_node) == SORD_URI) {
p->binary_uri = lilv_node_new_from_node(p->world, binary_node);
break;
}
}
- sord_iter_free(results);
+ sord_iter_free(i);
}
if (!p->binary_uri) {
LILV_WARNF("Plugin <%s> has no lv2:binary\n",
@@ -372,26 +363,23 @@ lilv_plugin_get_library_uri(const LilvPlugin* const_p)
return p->binary_uri;
}
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_plugin_get_data_uris(const LilvPlugin* p)
{
return p->data_uris;
}
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_get_class(const LilvPlugin* const_p)
{
LilvPlugin* p = (LilvPlugin*)const_p;
lilv_plugin_load_if_necessary(p);
if (!p->plugin_class) {
// <plugin> a ?class
- SordIter* results = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- p->world->uris.rdf_a,
- NULL);
+ SordIter* results = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ p->world->uris.rdf_a,
+ NULL);
FOREACH_MATCH(results) {
const SordNode* class_node = sord_iter_get_node(results, SORD_OBJECT);
if (sord_node_get_type(class_node) != SORD_URI) {
@@ -429,8 +417,7 @@ lilv_plugin_get_value_internal(const LilvPlugin* p,
p->world, p->plugin_uri->node, predicate, NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_verify(const LilvPlugin* plugin)
{
LilvNode* rdf_type = lilv_new_uri(plugin->world, LILV_NS_RDF "type");
@@ -459,8 +446,7 @@ lilv_plugin_verify(const LilvPlugin* plugin)
return true;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_name(const LilvPlugin* plugin)
{
LilvNodes* results = lilv_plugin_get_value_internal(
@@ -481,8 +467,7 @@ lilv_plugin_get_name(const LilvPlugin* plugin)
return ret;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_value(const LilvPlugin* p,
const LilvNode* predicate)
{
@@ -490,16 +475,14 @@ lilv_plugin_get_value(const LilvPlugin* p,
return lilv_world_find_nodes(p->world, p->plugin_uri, predicate, NULL);
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports(const LilvPlugin* p)
{
lilv_plugin_load_ports_if_necessary(p);
return p->num_ports;
}
-LILV_API
-void
+LILV_API void
lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
float* min_values,
float* max_values,
@@ -546,8 +529,7 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
}
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
const LilvNode* class_1,
va_list args)
@@ -559,10 +541,10 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
// Build array of classes from args so we can walk it several times
size_t n_classes = 0;
const LilvNode** classes = NULL;
- for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)); ) {
+ for (LilvNode* c = NULL; (c = va_arg(args, LilvNode*)); ) {
classes = (const LilvNode**)realloc(
classes, ++n_classes * sizeof(LilvNode*));
- classes[n_classes - 1] = class_i;
+ classes[n_classes - 1] = c;
}
// Check each port against every type
@@ -587,8 +569,7 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
return count;
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
const LilvNode* class_1, ...)
{
@@ -601,8 +582,7 @@ lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
return count;
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_latency(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -620,7 +600,7 @@ lilv_plugin_has_latency(const LilvPlugin* p)
port,
p->world->uris.lv2_portProperty,
p->world->uris.lv2_reportsLatency);
- SordIter* des = lilv_world_query_internal(
+ SordIter* des = lilv_world_query_internal(
p->world,
port,
p->world->uris.lv2_designation,
@@ -640,7 +620,7 @@ lilv_plugin_has_latency(const LilvPlugin* p)
static const LilvPort*
lilv_plugin_get_port_by_property(const LilvPlugin* plugin,
- const LilvNode* port_property)
+ const SordNode* port_property)
{
lilv_plugin_load_ports_if_necessary(plugin);
for (uint32_t i = 0; i < plugin->num_ports; ++i) {
@@ -649,7 +629,7 @@ lilv_plugin_get_port_by_property(const LilvPlugin* plugin,
plugin->world,
port->node->node,
plugin->world->uris.lv2_portProperty,
- port_property->node);
+ port_property);
const bool found = !sord_iter_end(iter);
sord_iter_free(iter);
@@ -662,8 +642,7 @@ lilv_plugin_get_port_by_property(const LilvPlugin* plugin,
return NULL;
}
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
const LilvNode* port_class,
const LilvNode* designation)
@@ -690,18 +669,13 @@ lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
return NULL;
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_latency_port_index(const LilvPlugin* p)
{
- LilvNode* prop = lilv_node_new_from_node(
- p->world, p->world->uris.lv2_reportsLatency);
- LilvNode* des = lilv_node_new_from_node(
- p->world, p->world->uris.lv2_latency);
- const LilvPort* prop_port = lilv_plugin_get_port_by_property(p, prop);
- const LilvPort* des_port = lilv_plugin_get_port_by_property(p, des);
- lilv_node_free(prop);
- lilv_node_free(des);
+ const LilvPort* prop_port = lilv_plugin_get_port_by_property(
+ p, p->world->uris.lv2_reportsLatency);
+ const LilvPort* des_port = lilv_plugin_get_port_by_property(
+ p, p->world->uris.lv2_latency);
if (prop_port) {
return prop_port->index;
} else if (des_port) {
@@ -711,8 +685,7 @@ lilv_plugin_get_latency_port_index(const LilvPlugin* p)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_feature(const LilvPlugin* p,
const LilvNode* feature)
{
@@ -730,8 +703,7 @@ lilv_plugin_has_feature(const LilvPlugin* p,
return false;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_supported_features(const LilvPlugin* p)
{
LilvNodes* optional = lilv_plugin_get_optional_features(p);
@@ -742,8 +714,7 @@ lilv_plugin_get_supported_features(const LilvPlugin* p)
return result;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_optional_features(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -753,8 +724,7 @@ lilv_plugin_get_optional_features(const LilvPlugin* p)
NULL);
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_required_features(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -764,8 +734,7 @@ lilv_plugin_get_required_features(const LilvPlugin* p)
NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_extension_data(const LilvPlugin* p,
const LilvNode* uri)
{
@@ -783,15 +752,13 @@ lilv_plugin_has_extension_data(const LilvPlugin* p,
uri->node);
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_extension_data(const LilvPlugin* p)
{
return lilv_plugin_get_value_internal(p, p->world->uris.lv2_extensionData);
}
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_index(const LilvPlugin* p,
uint32_t index)
{
@@ -802,8 +769,7 @@ lilv_plugin_get_port_by_index(const LilvPlugin* p,
return NULL;
}
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
const LilvNode* symbol)
{
@@ -817,8 +783,7 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
return NULL;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_project(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -826,11 +791,10 @@ lilv_plugin_get_project(const LilvPlugin* p)
SordNode* lv2_project = sord_new_uri(p->world->world,
(const uint8_t*)LV2_CORE__project);
- SordIter* projects = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- lv2_project,
- NULL);
+ SordIter* projects = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ lv2_project,
+ NULL);
sord_node_free(p->world->world, lv2_project);
@@ -890,8 +854,7 @@ lilv_plugin_get_author(const LilvPlugin* p)
return author;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_name(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
@@ -905,8 +868,7 @@ lilv_plugin_get_author_name(const LilvPlugin* plugin)
return NULL;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_email(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
@@ -920,8 +882,7 @@ lilv_plugin_get_author_email(const LilvPlugin* plugin)
return NULL;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
@@ -935,15 +896,13 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
return NULL;
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_is_replaced(const LilvPlugin* plugin)
{
return plugin->replaced;
}
-LILV_API
-LilvUIs*
+LILV_API LilvUIs*
lilv_plugin_get_uis(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -954,11 +913,10 @@ lilv_plugin_get_uis(const LilvPlugin* p)
(const uint8_t*)LV2_UI__binary);
LilvUIs* result = lilv_uis_new();
- SordIter* uis = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- ui_ui_node,
- NULL);
+ SordIter* uis = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ ui_ui_node,
+ NULL);
FOREACH_MATCH(uis) {
const SordNode* ui = sord_iter_get_node(uis, SORD_OBJECT);
@@ -996,8 +954,7 @@ lilv_plugin_get_uis(const LilvPlugin* p)
}
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type)
{
lilv_plugin_load_if_necessary(plugin);
@@ -1057,8 +1014,7 @@ maybe_write_prefixes(SerdWriter* writer, SerdEnv* env, FILE* file)
}
}
-LILV_API
-void
+LILV_API void
lilv_plugin_write_description(LilvWorld* world,
const LilvPlugin* plugin,
const LilvNode* base_uri,
@@ -1097,8 +1053,7 @@ lilv_plugin_write_description(LilvWorld* world,
serd_env_free(env);
}
-LILV_API
-void
+LILV_API void
lilv_plugin_write_manifest_entry(LilvWorld* world,
const LilvPlugin* plugin,
const LilvNode* base_uri,
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 46308ab..599d97a 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -33,9 +33,9 @@ lilv_plugin_class_new(LilvWorld* world,
pc->world = world;
pc->uri = lilv_node_new_from_node(world, uri);
pc->label = lilv_node_new(world, LILV_VALUE_STRING, label);
- pc->parent_uri = (parent_node)
- ? lilv_node_new_from_node(world, parent_node)
- : NULL;
+ pc->parent_uri = (parent_node
+ ? lilv_node_new_from_node(world, parent_node)
+ : NULL);
return pc;
}
@@ -49,33 +49,25 @@ lilv_plugin_class_free(LilvPluginClass* plugin_class)
free(plugin_class);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class)
{
- if (plugin_class->parent_uri)
- return plugin_class->parent_uri;
- else
- return NULL;
+ return plugin_class->parent_uri ? plugin_class->parent_uri : NULL;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class)
{
- assert(plugin_class->uri);
return plugin_class->uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_label(const LilvPluginClass* plugin_class)
{
return plugin_class->label;
}
-LILV_API
-LilvPluginClasses*
+LILV_API LilvPluginClasses*
lilv_plugin_class_get_children(const LilvPluginClass* plugin_class)
{
// Returned list doesn't own categories
diff --git a/src/port.c b/src/port.c
index 5d076fd..b1eccf6 100644
--- a/src/port.c
+++ b/src/port.c
@@ -50,8 +50,7 @@ lilv_port_free(const LilvPlugin* plugin, LilvPort* port)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_port_is_a(const LilvPlugin* plugin,
const LilvPort* port,
const LilvNode* port_class)
@@ -63,21 +62,18 @@ lilv_port_is_a(const LilvPlugin* plugin,
return false;
}
-LILV_API
-bool
+LILV_API bool
lilv_port_has_property(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* property)
{
- return lilv_world_ask_internal(
- p->world,
- port->node->node,
- p->world->uris.lv2_portProperty,
- lilv_node_as_node(property));
+ return lilv_world_ask_internal(p->world,
+ port->node->node,
+ p->world->uris.lv2_portProperty,
+ property->node);
}
-LILV_API
-bool
+LILV_API bool
lilv_port_supports_event(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* event)
@@ -90,7 +86,7 @@ lilv_port_supports_event(const LilvPlugin* p,
if (lilv_world_ask_internal(p->world,
port->node->node,
sord_new_uri(p->world->world, *pred),
- lilv_node_as_node(event))) {
+ event->node)) {
return true;
}
}
@@ -102,23 +98,20 @@ lilv_port_get_value_by_node(const LilvPlugin* p,
const LilvPort* port,
const SordNode* predicate)
{
- return lilv_world_find_nodes_internal(
- p->world,
- port->node->node,
- predicate,
- NULL);
+ return lilv_world_find_nodes_internal(p->world,
+ port->node->node,
+ predicate,
+ NULL);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_port_get_node(const LilvPlugin* plugin,
const LilvPort* port)
{
return port->node;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_port_get_value(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* predicate)
@@ -129,13 +122,10 @@ lilv_port_get_value(const LilvPlugin* p,
return NULL;
}
- return lilv_port_get_value_by_node(
- p, port,
- lilv_node_as_node(predicate));
+ return lilv_port_get_value_by_node(p, port, predicate->node);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_port_get(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* predicate)
@@ -149,24 +139,21 @@ lilv_port_get(const LilvPlugin* p,
return value;
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_port_get_index(const LilvPlugin* p,
const LilvPort* port)
{
return port->index;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_port_get_symbol(const LilvPlugin* p,
const LilvPort* port)
{
return port->symbol;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_port_get_name(const LilvPlugin* p,
const LilvPort* port)
{
@@ -188,16 +175,14 @@ lilv_port_get_name(const LilvPlugin* p,
return ret;
}
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_port_get_classes(const LilvPlugin* p,
const LilvPort* port)
{
return port->classes;
}
-LILV_API
-void
+LILV_API void
lilv_port_get_range(const LilvPlugin* p,
const LilvPort* port,
LilvNode** def,
@@ -230,8 +215,7 @@ lilv_port_get_range(const LilvPlugin* p,
}
}
-LILV_API
-LilvScalePoints*
+LILV_API LilvScalePoints*
lilv_port_get_scale_points(const LilvPlugin* p,
const LilvPort* port)
{
@@ -248,15 +232,13 @@ lilv_port_get_scale_points(const LilvPlugin* p,
FOREACH_MATCH(points) {
const SordNode* point = sord_iter_get_node(points, SORD_OBJECT);
- LilvNode* value = lilv_plugin_get_unique(
- p,
- point,
- p->world->uris.rdf_value);
+ LilvNode* value = lilv_plugin_get_unique(p,
+ point,
+ p->world->uris.rdf_value);
- LilvNode* label = lilv_plugin_get_unique(
- p,
- point,
- p->world->uris.rdfs_label);
+ LilvNode* label = lilv_plugin_get_unique(p,
+ point,
+ p->world->uris.rdfs_label);
if (value && label) {
zix_tree_insert(
@@ -269,8 +251,7 @@ lilv_port_get_scale_points(const LilvPlugin* p,
return ret;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_port_get_properties(const LilvPlugin* p,
const LilvPort* port)
{
diff --git a/src/scalepoint.c b/src/scalepoint.c
index 0138e61..55c2315 100644
--- a/src/scalepoint.c
+++ b/src/scalepoint.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2011 David Robillard <http://drobilla.net>
+ Copyright 2007-2014 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -20,8 +20,7 @@
LilvScalePoint*
lilv_scale_point_new(LilvNode* value, LilvNode* label)
{
- LilvScalePoint* point = (LilvScalePoint*)malloc(
- sizeof(struct LilvScalePointImpl));
+ LilvScalePoint* point = (LilvScalePoint*)malloc(sizeof(LilvScalePoint));
point->value = value;
point->label = label;
return point;
@@ -37,15 +36,13 @@ lilv_scale_point_free(LilvScalePoint* point)
}
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_scale_point_get_value(const LilvScalePoint* p)
{
return p->value;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_scale_point_get_label(const LilvScalePoint* p)
{
return p->label;
diff --git a/src/state.c b/src/state.c
index 0a775c9..b0cec18 100644
--- a/src/state.c
+++ b/src/state.c
@@ -319,8 +319,7 @@ state_strerror(LV2_State_Status st)
}
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_instance(const LilvPlugin* plugin,
LilvInstance* instance,
LV2_URID_Map* map,
@@ -396,8 +395,7 @@ lilv_state_new_from_instance(const LilvPlugin* plugin,
return state;
}
-LILV_API
-void
+LILV_API void
lilv_state_restore(const LilvState* state,
LilvInstance* instance,
LilvSetPortValueFunc set_value,
@@ -572,8 +570,7 @@ new_state_from_model(LilvWorld* world,
return state;
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_world(LilvWorld* world,
LV2_URID_Map* map,
const LilvNode* node)
@@ -590,8 +587,7 @@ lilv_state_new_from_world(LilvWorld* world,
return state;
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_file(LilvWorld* world,
LV2_URID_Map* map,
const LilvNode* subject,
@@ -644,8 +640,7 @@ set_prefixes(SerdEnv* env)
SET_PSET(env, USTR("xsd"), USTR(LILV_NS_XSD));
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_string(LilvWorld* world,
LV2_URID_Map* map,
const char* str)
@@ -930,8 +925,7 @@ lilv_state_make_links(const LilvState* state, const char* dir)
}
}
-LILV_API
-int
+LILV_API int
lilv_state_save(LilvWorld* world,
LV2_URID_Map* map,
LV2_URID_Unmap* unmap,
@@ -986,8 +980,7 @@ lilv_state_save(LilvWorld* world,
return ret;
}
-LILV_API
-char*
+LILV_API char*
lilv_state_to_string(LilvWorld* world,
LV2_URID_Map* map,
LV2_URID_Unmap* unmap,
@@ -1012,8 +1005,7 @@ lilv_state_to_string(LilvWorld* world,
return (char*)serd_chunk_sink_finish(&chunk);
}
-LILV_API
-void
+LILV_API void
lilv_state_free(LilvState* state)
{
if (state) {
@@ -1038,8 +1030,7 @@ lilv_state_free(LilvState* state)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_state_equals(const LilvState* a, const LilvState* b)
{
if (!lilv_node_equals(a->plugin_uri, b->plugin_uri)
@@ -1082,29 +1073,25 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
return true;
}
-LILV_API
-unsigned
+LILV_API unsigned
lilv_state_get_num_properties(const LilvState* state)
{
return state->num_props;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_state_get_plugin_uri(const LilvState* state)
{
return state->plugin_uri;
}
-LILV_API
-const char*
+LILV_API const char*
lilv_state_get_label(const LilvState* state)
{
return state->label;
}
-LILV_API
-void
+LILV_API void
lilv_state_set_label(LilvState* state, const char* label)
{
const size_t len = strlen(label);
diff --git a/src/ui.c b/src/ui.c
index 6eac62a..a11f0a5 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -52,30 +52,19 @@ void
lilv_ui_free(LilvUI* ui)
{
lilv_node_free(ui->uri);
- ui->uri = NULL;
-
lilv_node_free(ui->bundle_uri);
- ui->bundle_uri = NULL;
-
lilv_node_free(ui->binary_uri);
- ui->binary_uri = NULL;
-
lilv_nodes_free(ui->classes);
-
free(ui);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_uri(const LilvUI* ui)
{
- assert(ui);
- assert(ui->uri);
return ui->uri;
}
-LILV_API
-unsigned
+LILV_API unsigned
lilv_ui_is_supported(const LilvUI* ui,
LilvUISupportedFunc supported_func,
const LilvNode* container_type,
@@ -97,34 +86,26 @@ lilv_ui_is_supported(const LilvUI* ui,
return 0;
}
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_ui_get_classes(const LilvUI* ui)
{
return ui->classes;
}
-LILV_API
-bool
+LILV_API bool
lilv_ui_is_a(const LilvUI* ui, const LilvNode* ui_class_uri)
{
return lilv_nodes_contains(ui->classes, ui_class_uri);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_bundle_uri(const LilvUI* ui)
{
- assert(ui);
- assert(ui->bundle_uri);
return ui->bundle_uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_binary_uri(const LilvUI* ui)
{
- assert(ui);
- assert(ui->binary_uri);
return ui->binary_uri;
}
diff --git a/src/world.c b/src/world.c
index 48bf401..8983e40 100644
--- a/src/world.c
+++ b/src/world.c
@@ -23,8 +23,7 @@
#include "lilv_internal.h"
-LILV_API
-LilvWorld*
+LILV_API LilvWorld*
lilv_world_new(void)
{
LilvWorld* world = (LilvWorld*)malloc(sizeof(LilvWorld));
@@ -103,8 +102,7 @@ fail:
return NULL;
}
-LILV_API
-void
+LILV_API void
lilv_world_free(LilvWorld* world)
{
if (!world) {
@@ -155,8 +153,7 @@ lilv_world_free(LilvWorld* world)
free(world);
}
-LILV_API
-void
+LILV_API void
lilv_world_set_option(LilvWorld* world,
const char* option,
const LilvNode* value)
@@ -175,8 +172,7 @@ lilv_world_set_option(LilvWorld* world,
LILV_WARNF("Unrecognized or invalid option `%s'\n", option);
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_world_find_nodes(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -195,15 +191,13 @@ lilv_world_find_nodes(LilvWorld* world,
return NULL;
}
- return lilv_world_find_nodes_internal(
- world,
- subject ? subject->node : NULL,
- predicate->node,
- object ? object->node : NULL);
+ return lilv_world_find_nodes_internal(world,
+ subject ? subject->node : NULL,
+ predicate->node,
+ object ? object->node : NULL);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_world_get(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -237,8 +231,7 @@ lilv_world_ask_internal(LilvWorld* world,
return sord_ask(world->model, subject, predicate, object, NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_world_ask(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -319,9 +312,8 @@ lilv_collection_get_by_uri(const ZixTree* const_seq,
ZixTree* seq = (ZixTree*)const_seq;
struct LilvHeader key = { NULL, (LilvNode*)uri };
-
- ZixTreeIter* i = NULL;
- ZixStatus st = zix_tree_find(seq, &key, &i);
+ ZixTreeIter* i = NULL;
+ ZixStatus st = zix_tree_find(seq, &key, &i);
if (!st) {
return (struct LilvHeader*)zix_tree_get(i);
}
@@ -340,12 +332,11 @@ lilv_world_add_spec(LilvWorld* world,
spec->data_uris = lilv_nodes_new();
// Add all data files (rdfs:seeAlso)
- SordIter* files = sord_search(
- world->model,
- specification_node,
- world->uris.rdfs_seeAlso,
- NULL,
- NULL);
+ SordIter* files = sord_search(world->model,
+ specification_node,
+ world->uris.rdfs_seeAlso,
+ NULL,
+ NULL);
FOREACH_MATCH(files) {
const SordNode* file_node = sord_iter_get_node(files, SORD_OBJECT);
zix_tree_insert((ZixTree*)spec->data_uris,
@@ -397,12 +388,11 @@ lilv_world_add_plugin(LilvWorld* world,
#endif
// Add all plugin data files (rdfs:seeAlso)
- SordIter* files = sord_search(
- world->model,
- plugin_node,
- world->uris.rdfs_seeAlso,
- NULL,
- NULL);
+ SordIter* files = sord_search(world->model,
+ plugin_node,
+ world->uris.rdfs_seeAlso,
+ NULL,
+ NULL);
FOREACH_MATCH(files) {
const SordNode* file_node = sord_iter_get_node(files, SORD_OBJECT);
zix_tree_insert((ZixTree*)plugin->data_uris,
@@ -444,22 +434,20 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
LV2_Dyn_Manifest_Handle handle = NULL;
// ?dman a dynman:DynManifest
- SordIter* dmanifests = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.dman_DynManifest,
- bundle_node);
+ SordIter* dmanifests = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.dman_DynManifest,
+ bundle_node);
FOREACH_MATCH(dmanifests) {
const SordNode* dmanifest = sord_iter_get_node(dmanifests, SORD_SUBJECT);
// ?dman lv2:binary ?binary
- SordIter* binaries = sord_search(
- world->model,
- dmanifest,
- world->uris.lv2_binary,
- NULL,
- bundle_node);
+ SordIter* binaries = sord_search(world->model,
+ dmanifest,
+ world->uris.lv2_binary,
+ NULL,
+ bundle_node);
if (sord_iter_end(binaries)) {
sord_iter_free(binaries);
LILV_ERRORF("Dynamic manifest in <%s> has no binaries, ignored\n",
@@ -565,8 +553,7 @@ lilv_world_get_manifest_uri(LilvWorld* world, LilvNode* bundle_uri)
return manifest;
}
-LILV_API
-void
+LILV_API void
lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
{
if (!lilv_node_is_uri(bundle_uri)) {
@@ -587,12 +574,11 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
}
// ?plugin a lv2:Plugin
- SordIter* plug_results = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.lv2_Plugin,
- bundle_node);
+ SordIter* plug_results = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.lv2_Plugin,
+ bundle_node);
FOREACH_MATCH(plug_results) {
const SordNode* plug = sord_iter_get_node(plug_results, SORD_SUBJECT);
lilv_world_add_plugin(world, plug, manifest, NULL, bundle_node);
@@ -602,12 +588,11 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
lilv_world_load_dyn_manifest(world, bundle_node, manifest);
// ?specification a lv2:Specification
- SordIter* spec_results = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.lv2_Specification,
- bundle_node);
+ SordIter* spec_results = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.lv2_Specification,
+ bundle_node);
FOREACH_MATCH(spec_results) {
const SordNode* spec = sord_iter_get_node(spec_results, SORD_SUBJECT);
lilv_world_add_spec(world, spec, bundle_node);
@@ -648,8 +633,7 @@ lilv_world_unload_file(LilvWorld* world, LilvNode* file)
return 1;
}
-LILV_API
-int
+LILV_API int
lilv_world_unload_bundle(LilvWorld* world, LilvNode* bundle_uri)
{
// Remove loaded_files entry for manifest.ttl
@@ -682,26 +666,17 @@ static void
lilv_world_load_directory(LilvWorld* world, const char* dir_path)
{
char* path = lilv_expand(dir_path);
- if (!path) {
- LILV_WARNF("Empty path `%s'\n", path);
- return;
+ if (path) {
+ lilv_dir_for_each(path, world, load_dir_entry);
+ free(path);
}
-
- lilv_dir_for_each(path, world, load_dir_entry);
- free(path);
-}
-
-static bool
-is_path_sep(char c)
-{
- return c == LILV_PATH_SEP[0];
}
static const char*
first_path_sep(const char* path)
{
for (const char* p = path; *p != '\0'; ++p) {
- if (is_path_sep(*p)) {
+ if (*p == LILV_PATH_SEP[0]) {
return p;
}
}
@@ -754,12 +729,11 @@ lilv_world_load_plugin_classes(LilvWorld* world)
a menu), they won't be seen anyway...
*/
- SordIter* classes = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.rdfs_Class,
- NULL);
+ SordIter* classes = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.rdfs_Class,
+ NULL);
FOREACH_MATCH(classes) {
const SordNode* class_node = sord_iter_get_node(classes, SORD_SUBJECT);
@@ -789,8 +763,7 @@ lilv_world_load_plugin_classes(LilvWorld* world)
sord_iter_free(classes);
}
-LILV_API
-void
+LILV_API void
lilv_world_load_all(LilvWorld* world)
{
const char* lv2_path = getenv("LV2_PATH");
@@ -808,7 +781,7 @@ lilv_world_load_all(LilvWorld* world)
if (sord_ask(world->model,
NULL,
world->uris.dc_replaces,
- lilv_node_as_node(lilv_plugin_get_uri(plugin)),
+ lilv_plugin_get_uri(plugin)->node,
NULL)) {
// TODO: Check if replacement is a known plugin? (expensive)
((LilvPlugin*)plugin)->replaced = true;
@@ -829,8 +802,8 @@ lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri)
}
serd_reader_add_blank_prefix(reader, lilv_world_blank_node_prefix(world));
- const uint8_t* uri_str = sord_node_get_string(uri->node);
- SerdStatus st = serd_reader_read_file(reader, uri_str);
+ const SerdStatus st = serd_reader_read_file(
+ reader, sord_node_get_string(uri->node));
if (st) {
LILV_ERRORF("Error loading file `%s'\n", lilv_node_as_string(uri));
return st;
@@ -842,8 +815,7 @@ lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri)
return SERD_SUCCESS;
}
-LILV_API
-int
+LILV_API int
lilv_world_load_resource(LilvWorld* world,
const LilvNode* resource)
{
@@ -874,8 +846,7 @@ lilv_world_load_resource(LilvWorld* world,
return n_read;
}
-LILV_API
-int
+LILV_API int
lilv_world_unload_resource(LilvWorld* world,
const LilvNode* resource)
{
@@ -892,10 +863,10 @@ lilv_world_unload_resource(LilvWorld* world,
NULL, NULL);
FOREACH_MATCH(files) {
const SordNode* file = sord_iter_get_node(files, SORD_OBJECT);
- const uint8_t* file_str = sord_node_get_string(file);
LilvNode* file_node = lilv_node_new_from_node(world, file);
if (sord_node_get_type(file) != SORD_URI) {
- LILV_ERRORF("rdfs:seeAlso node `%s' is not a URI\n", file_str);
+ LILV_ERRORF("rdfs:seeAlso node `%s' is not a URI\n",
+ sord_node_get_string(file));
} else if (!lilv_world_drop_graph(world, file_node)) {
lilv_world_unload_file(world, file_node);
++n_dropped;
@@ -907,22 +878,19 @@ lilv_world_unload_resource(LilvWorld* world,
return n_dropped;
}
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_world_get_plugin_class(const LilvWorld* world)
{
return world->lv2_plugin_class;
}
-LILV_API
-const LilvPluginClasses*
+LILV_API const LilvPluginClasses*
lilv_world_get_plugin_classes(const LilvWorld* world)
{
return world->plugin_classes;
}
-LILV_API
-const LilvPlugins*
+LILV_API const LilvPlugins*
lilv_world_get_all_plugins(const LilvWorld* world)
{
return world->plugins;