diff options
author | David Robillard <d@drobilla.net> | 2024-11-17 10:49:38 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-24 19:04:51 -0500 |
commit | da2be0adcd029ec65bfed26af4f811e244705730 (patch) | |
tree | b15df23958a5b2a3d80763b084833bf9fc49f609 /src | |
parent | 1c788efec00951afe893be363f83c125cb19db23 (diff) | |
download | jalv-da2be0adcd029ec65bfed26af4f811e244705730.tar.gz jalv-da2be0adcd029ec65bfed26af4f811e244705730.tar.bz2 jalv-da2be0adcd029ec65bfed26af4f811e244705730.zip |
Factor out free_control()
Diffstat (limited to 'src')
-rw-r--r-- | src/control.c | 13 | ||||
-rw-r--r-- | src/control.h | 4 | ||||
-rw-r--r-- | src/jalv.c | 10 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/control.c b/src/control.c index 451eac5..19cf3e9 100644 --- a/src/control.c +++ b/src/control.c @@ -169,6 +169,19 @@ new_property_control(LilvWorld* const world, } void +free_control(ControlID* const control) +{ + lilv_node_free(control->node); + lilv_node_free(control->symbol); + lilv_node_free(control->label); + lilv_node_free(control->group); + lilv_node_free(control->min); + lilv_node_free(control->max); + lilv_node_free(control->def); + free(control); +} + +void add_control(Controls* controls, ControlID* control) { ControlID** const new_controls = (ControlID**)realloc( diff --git a/src/control.h b/src/control.h index 858f933..beafa47 100644 --- a/src/control.h +++ b/src/control.h @@ -80,6 +80,10 @@ new_property_control(LilvWorld* world, LV2_URID_Map* map, LV2_Atom_Forge* forge); +/// Free a control allocated with new_port_control() or new_property_control() +void +free_control(ControlID* control); + /// Add a control to the given controls set, reallocating as necessary void add_control(Controls* controls, ControlID* control); @@ -1229,15 +1229,7 @@ jalv_close(Jalv* const jalv) #endif for (unsigned i = 0; i < jalv->controls.n_controls; ++i) { - ControlID* const control = jalv->controls.controls[i]; - lilv_node_free(control->node); - lilv_node_free(control->symbol); - lilv_node_free(control->label); - lilv_node_free(control->group); - lilv_node_free(control->min); - lilv_node_free(control->max); - lilv_node_free(control->def); - free(control); + free_control(jalv->controls.controls[i]); } free(jalv->controls.controls); |