From d716c6d5e7c622d238d460a32ad7d02845fbc4d4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 31 Jan 2011 00:41:06 +0000 Subject: Replace more librdf_uri. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2881 a436a847-0d15-0410-975c-d299462d15a1 --- src/pluginclass.c | 11 ++++++----- src/value.c | 11 ++++------- src/world.c | 20 +++++++++----------- 3 files changed, 19 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/pluginclass.c b/src/pluginclass.c index 6f73083..910375c 100644 --- a/src/pluginclass.c +++ b/src/pluginclass.c @@ -35,12 +35,13 @@ slv2_plugin_class_new(SLV2World world, const char* label) { assert(!parent_node || librdf_node_is_resource(parent_node)); - librdf_uri* parent_uri = parent_node ? librdf_node_get_uri(parent_node) : NULL; SLV2PluginClass pc = (SLV2PluginClass)malloc(sizeof(struct _SLV2PluginClass)); - pc->world = world; - pc->parent_uri = (parent_uri ? slv2_value_new_librdf_uri(world, parent_node) : NULL); - pc->uri = slv2_value_new_librdf_uri(world, uri); - pc->label = slv2_value_new(world, SLV2_VALUE_STRING, label); + pc->world = world; + pc->uri = slv2_value_new_librdf_uri(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) + : NULL; return pc; } diff --git a/src/value.c b/src/value.c index 4799186..b1e141c 100644 --- a/src/value.c +++ b/src/value.c @@ -146,14 +146,11 @@ slv2_value_new_librdf_node(SLV2World world, librdf_node* node) SLV2Value slv2_value_new_librdf_uri(SLV2World world, librdf_node* node) { - assert(node); - assert(librdf_node_is_resource(node)); - librdf_uri* uri = librdf_node_get_uri(node); - assert(uri); + assert(node && librdf_node_is_resource(node)); SLV2Value val = (SLV2Value)malloc(sizeof(struct _SLV2Value)); - val->type = SLV2_VALUE_URI; - val->val.uri_val = librdf_new_uri_from_uri(uri); - val->str_val = (char*)librdf_uri_as_string(val->val.uri_val); + val->type = SLV2_VALUE_URI; + val->val.uri_val = librdf_new_uri_from_uri(librdf_node_get_uri(node)); + val->str_val = (char*)librdf_uri_as_string(val->val.uri_val); return val; } diff --git a/src/world.c b/src/world.c index d042643..77b3c7f 100644 --- a/src/world.c +++ b/src/world.c @@ -640,7 +640,8 @@ slv2_world_load_all(SLV2World world) librdf_new_node_from_node(world->lv2_plugin_node)); FOREACH_MATCH(plugins) { librdf_node* plugin_node = MATCH_SUBJECT(plugins); - librdf_uri* plugin_uri = librdf_node_get_uri(plugin_node); + const char* plugin_uri = (const char*)librdf_uri_as_string( + librdf_node_get_uri(plugin_node)); SLV2Matches bundles = slv2_world_find_statements( world, world->model, @@ -650,8 +651,7 @@ slv2_world_load_all(SLV2World world) if (slv2_matches_end(bundles)) { END_MATCH(bundles); - SLV2_ERRORF("Plugin <%s> somehow has no bundle, ignored\n", - librdf_uri_as_string(plugin_uri)); + SLV2_ERRORF("Plugin <%s> has no bundle, ignored\n", plugin_uri); continue; } @@ -661,7 +661,7 @@ slv2_world_load_all(SLV2World world) if (!slv2_matches_end(bundles)) { END_MATCH(bundles); SLV2_ERRORF("Plugin <%s> found in several bundles, ignored\n", - librdf_uri_as_string(plugin_uri)); + plugin_uri); continue; } @@ -674,9 +674,8 @@ slv2_world_load_all(SLV2World world) if (n_plugins > 0) { // Plugin results are in increasing sorted order SLV2Plugin prev = raptor_sequence_get_at(world->plugins, n_plugins - 1); - assert(strcmp( - slv2_value_as_string(slv2_plugin_get_uri(prev)), - (const char*)librdf_uri_as_string(plugin_uri)) < 0); + assert(strcmp(slv2_value_as_string(slv2_plugin_get_uri(prev)), + plugin_uri) < 0); } #endif @@ -694,11 +693,10 @@ slv2_world_load_all(SLV2World world) NULL); FOREACH_MATCH(dmanifests) { librdf_node* lib_node = MATCH_OBJECT(dmanifests); - librdf_uri* lib_uri = librdf_node_get_uri(lib_node); + const char* lib_uri = (const char*)librdf_uri_as_string( + librdf_node_get_uri(lib_node)); - if (dlopen( - slv2_uri_to_path((const char*)librdf_uri_as_string(lib_uri)), - RTLD_LAZY)) { + if (dlopen(slv2_uri_to_path(lib_uri, RTLD_LAZY))) { plugin->dynman_uri = slv2_value_new_librdf_uri(world, lib_node); } } -- cgit v1.2.1