From 920128cdb2bb7fe99a000965f26efb2f72cff524 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 31 Jan 2011 17:02:46 +0000 Subject: slv2_value_new_librdf_node => slv2_value_new_from_node . Remove slv2_value_new_librdf_uri. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2891 a436a847-0d15-0410-975c-d299462d15a1 --- src/plugin.c | 10 +++++----- src/pluginclass.c | 4 ++-- src/port.c | 2 +- src/slv2_internal.h | 3 +-- src/value.c | 24 +++++++----------------- src/world.c | 8 ++++---- 6 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index c1272aa..57e0dc6 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -125,7 +125,7 @@ slv2_plugin_query_node(SLV2Plugin p, SLV2Node subject, SLV2Node predicate) SLV2Values result = slv2_values_new(); FOREACH_MATCH(results) { SLV2Node node = MATCH_OBJECT(results); - SLV2Value value = slv2_value_new_librdf_node(p->world, node); + SLV2Value value = slv2_value_new_from_node(p->world, node); if (value) raptor_sequence_push(result, value); } @@ -226,7 +226,7 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p) if (librdf_node_is_resource(type)) { raptor_sequence_push( this_port->classes, - slv2_value_new_librdf_uri(p->world, type)); + slv2_value_new_from_node(p->world, type)); } else { SLV2_WARN("port has non-URI rdf:type\n"); } @@ -339,7 +339,7 @@ slv2_plugin_get_library_uri(SLV2Plugin p) FOREACH_MATCH(results) { SLV2Node binary_node = MATCH_OBJECT(results); if (librdf_node_is_resource(binary_node)) { - p->binary_uri = slv2_value_new_librdf_uri(p->world, binary_node); + p->binary_uri = slv2_value_new_from_node(p->world, binary_node); break; } } @@ -373,7 +373,7 @@ slv2_plugin_get_class(SLV2Plugin p) continue; } - SLV2Value class = slv2_value_new_librdf_uri(p->world, class_node); + SLV2Value class = slv2_value_new_from_node(p->world, class_node); if ( ! slv2_value_equals(class, p->world->lv2_plugin_class->uri)) { SLV2PluginClass plugin_class = slv2_plugin_classes_get_by_uri( @@ -848,7 +848,7 @@ slv2_plugin_get_uis(SLV2Plugin p) SLV2UI slv2_ui = slv2_ui_new( p->world, - slv2_value_new_librdf_uri(p->world, ui), + slv2_value_new_from_node(p->world, ui), type, binary); diff --git a/src/pluginclass.c b/src/pluginclass.c index 39f1764..9997253 100644 --- a/src/pluginclass.c +++ b/src/pluginclass.c @@ -37,10 +37,10 @@ slv2_plugin_class_new(SLV2World world, assert(!parent_node || librdf_node_is_resource(parent_node)); SLV2PluginClass pc = (SLV2PluginClass)malloc(sizeof(struct _SLV2PluginClass)); pc->world = world; - pc->uri = slv2_value_new_librdf_uri(world, uri); + pc->uri = slv2_value_new_from_node(world, uri); pc->label = slv2_value_new(world, SLV2_VALUE_STRING, label); pc->parent_uri = (parent_node) - ? slv2_value_new_librdf_uri(world, parent_node) + ? slv2_value_new_from_node(world, parent_node) : NULL; return pc; } diff --git a/src/port.c b/src/port.c index 8649413..ccf5844 100644 --- a/src/port.c +++ b/src/port.c @@ -148,7 +148,7 @@ slv2_values_from_stream_objects(SLV2Plugin p, SLV2Matches stream) FOREACH_MATCH(stream) { raptor_sequence_push( values, - slv2_value_new_librdf_node( + slv2_value_new_from_node( p->world, MATCH_OBJECT(stream))); } diff --git a/src/slv2_internal.h b/src/slv2_internal.h index 0bd1d60..aa8e878 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -259,8 +259,7 @@ struct _SLV2Value { }; SLV2Value slv2_value_new(SLV2World world, SLV2ValueType type, const char* val); -SLV2Value slv2_value_new_librdf_node(SLV2World world, SLV2Node node); -SLV2Value slv2_value_new_librdf_uri(SLV2World world, SLV2Node node); +SLV2Value slv2_value_new_from_node(SLV2World world, SLV2Node node); librdf_uri* slv2_value_as_librdf_uri(SLV2Value value); static inline SLV2Node slv2_node_copy(SLV2Node node) { diff --git a/src/value.c b/src/value.c index 93fb218..6117528 100644 --- a/src/value.c +++ b/src/value.c @@ -96,7 +96,7 @@ slv2_value_new(SLV2World world, SLV2ValueType type, const char* str) /** Create a new SLV2Value from @a node, or return NULL if impossible */ SLV2Value -slv2_value_new_librdf_node(SLV2World world, librdf_node* node) +slv2_value_new_from_node(SLV2World world, librdf_node* node) { SLV2Value result = NULL; librdf_uri* datatype_uri = NULL; @@ -104,8 +104,12 @@ slv2_value_new_librdf_node(SLV2World world, librdf_node* node) switch (librdf_node_get_type(node)) { case LIBRDF_NODE_TYPE_RESOURCE: - type = SLV2_VALUE_URI; - result = slv2_value_new_librdf_uri(world, node); + type = SLV2_VALUE_URI; + result = (SLV2Value)malloc(sizeof(struct _SLV2Value)); + result->type = SLV2_VALUE_URI; + result->val.uri_val = slv2_node_copy(node); + result->str_val = (char*)librdf_uri_as_string( + librdf_node_get_uri(result->val.uri_val)); break; case LIBRDF_NODE_TYPE_LITERAL: datatype_uri = librdf_node_get_literal_value_datatype_uri(node); @@ -143,20 +147,6 @@ slv2_value_new_librdf_node(SLV2World world, librdf_node* node) } -/* private */ -SLV2Value -slv2_value_new_librdf_uri(SLV2World world, librdf_node* node) -{ - assert(node && librdf_node_is_resource(node)); - SLV2Value val = (SLV2Value)malloc(sizeof(struct _SLV2Value)); - val->type = SLV2_VALUE_URI; - val->val.uri_val = slv2_node_copy(node); - val->str_val = (char*)librdf_uri_as_string( - librdf_node_get_uri(val->val.uri_val)); - return val; -} - - SLV2Value slv2_value_new_uri(SLV2World world, const char* uri) { diff --git a/src/world.c b/src/world.c index f9f4006..9c8200a 100644 --- a/src/world.c +++ b/src/world.c @@ -673,7 +673,7 @@ slv2_world_load_all(SLV2World world) END_MATCH(bundles); // Add a new plugin to the world - SLV2Value uri = slv2_value_new_librdf_uri(world, plugin_node); + SLV2Value uri = slv2_value_new_from_node(world, plugin_node); const unsigned n_plugins = raptor_sequence_size(world->plugins); #ifndef NDEBUG if (n_plugins > 0) { @@ -685,7 +685,7 @@ slv2_world_load_all(SLV2World world) #endif SLV2Plugin plugin = slv2_plugin_new( - world, uri, slv2_value_new_librdf_uri(world, bundle_node)); + world, uri, slv2_value_new_from_node(world, bundle_node)); raptor_sequence_push(world->plugins, plugin); @@ -702,7 +702,7 @@ slv2_world_load_all(SLV2World world) librdf_node_get_uri(lib_node)); if (dlopen(slv2_uri_to_path(lib_uri, RTLD_LAZY))) { - plugin->dynman_uri = slv2_value_new_librdf_uri(world, lib_node); + plugin->dynman_uri = slv2_value_new_from_node(world, lib_node); } } END_MATCH(dmanifests); @@ -716,7 +716,7 @@ slv2_world_load_all(SLV2World world) FOREACH_MATCH(files) { SLV2Node file_node = MATCH_OBJECT(files); raptor_sequence_push(plugin->data_uris, - slv2_value_new_librdf_uri(world, file_node)); + slv2_value_new_from_node(world, file_node)); } END_MATCH(files); -- cgit v1.2.1