From 2f71e8570bcd37ad681bde7d51c433701a0028ab Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 3 Jan 2012 23:21:27 +0000 Subject: Add lilv_state_get_num_properties(). Rearrange state code. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3912 a436a847-0d15-0410-975c-d299462d15a1 --- src/state.c | 71 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/state.c b/src/state.c index 7d35f19..c747937 100644 --- a/src/state.c +++ b/src/state.c @@ -81,13 +81,6 @@ value_cmp(const void* a, const void* b) return strcmp(pa->symbol, pb->symbol); } -LILV_API -const LilvNode* -lilv_state_get_plugin_uri(const LilvState* state) -{ - return state->plugin_uri; -} - static PortValue* append_port_value(LilvState* state, const char* port_symbol, @@ -101,25 +94,6 @@ append_port_value(LilvState* state, return pv; } -LILV_API -const char* -lilv_state_get_label(const LilvState* state) -{ - return state->label; -} - -LILV_API -void -lilv_state_set_label(LilvState* state, - const char* label) -{ - if (state->label) { - free(state->label); - } - - state->label = label ? lilv_strdup(label) : NULL; -} - #ifdef HAVE_LV2_STATE static int store_callback(void* handle, @@ -856,6 +830,19 @@ lilv_state_save(LilvWorld* world, return 0; } +LILV_API +void +lilv_state_free(LilvState* state) +{ + if (state) { + lilv_node_free(state->plugin_uri); + free(state->props); + free(state->values); + free(state->label); + free(state); + } +} + LILV_API bool lilv_state_equals(const LilvState* a, const LilvState* b) @@ -894,15 +881,35 @@ lilv_state_equals(const LilvState* a, const LilvState* b) return true; } +LILV_API +unsigned +lilv_state_get_num_properties(const LilvState* state) +{ + return state->num_props; +} + +LILV_API +const LilvNode* +lilv_state_get_plugin_uri(const LilvState* state) +{ + return state->plugin_uri; +} + +LILV_API +const char* +lilv_state_get_label(const LilvState* state) +{ + return state->label; +} + LILV_API void -lilv_state_free(LilvState* state) +lilv_state_set_label(LilvState* state, + const char* label) { - if (state) { - lilv_node_free(state->plugin_uri); - free(state->props); - free(state->values); + if (state->label) { free(state->label); - free(state); } + + state->label = label ? lilv_strdup(label) : NULL; } -- cgit v1.2.1