summaryrefslogtreecommitdiffstats
path: root/src/state.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-03 23:21:27 +0000
committerDavid Robillard <d@drobilla.net>2012-01-03 23:21:27 +0000
commit2f71e8570bcd37ad681bde7d51c433701a0028ab (patch)
tree177704b6d8f9ea454fb92034e20978ee5bf351ac /src/state.c
parentd1e9dbbba3b4bb91506ad0dab1f7a0e833ac8d36 (diff)
downloadlilv-2f71e8570bcd37ad681bde7d51c433701a0028ab.tar.gz
lilv-2f71e8570bcd37ad681bde7d51c433701a0028ab.tar.bz2
lilv-2f71e8570bcd37ad681bde7d51c433701a0028ab.zip
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
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c71
1 files changed, 39 insertions, 32 deletions
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,
@@ -857,6 +831,19 @@ lilv_state_save(LilvWorld* world,
}
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)
{
@@ -895,14 +882,34 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
}
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;
}