aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-11-16 13:16:43 -0500
committerDavid Robillard <d@drobilla.net>2024-11-24 19:02:51 -0500
commit245c93daa3b902a1a9267069df9e632cede6a018 (patch)
treef3e04735036cd1584b0687a1784ae7da10a800d1 /src
parentcdf09e48f7191b0fbf7027cf5c57c38df563791a (diff)
downloadjalv-245c93daa3b902a1a9267069df9e632cede6a018.tar.gz
jalv-245c93daa3b902a1a9267069df9e632cede6a018.tar.bz2
jalv-245c93daa3b902a1a9267069df9e632cede6a018.zip
Reuse jalv_port_by_symbol() and eliminate duplicated code
Diffstat (limited to 'src')
-rw-r--r--src/jalv_console.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/jalv_console.c b/src/jalv_console.c
index 9ffe42b..430dfe1 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -246,15 +246,7 @@ jalv_process_command(Jalv* jalv, const char* cmd)
}
} else if (sscanf(cmd, "set %1023[a-zA-Z0-9_] %f", sym, &value) == 2 ||
sscanf(cmd, "%1023[a-zA-Z0-9_] = %f", sym, &value) == 2) {
- JalvPort* port = NULL;
- for (uint32_t i = 0; i < jalv->num_ports; ++i) {
- JalvPort* const p = &jalv->ports[i];
- const LilvNode* s = lilv_port_get_symbol(jalv->plugin, p->lilv_port);
- if (!strcmp(lilv_node_as_string(s), sym)) {
- port = p;
- break;
- }
- }
+ JalvPort* const port = jalv_port_by_symbol(jalv, sym);
if (port) {
port->control = value;
jalv_print_control(jalv, port, value);