From 84fd2ad527948c91dbdb4df46b374de01a586253 Mon Sep 17 00:00:00 2001 From: Skrylar Date: Tue, 26 Mar 2019 15:51:37 -0500 Subject: [PATCH] only calculate second port name if needed --- src/jaq.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/jaq.cc b/src/jaq.cc index b8dde17..16d3bfc 100644 --- a/src/jaq.cc +++ b/src/jaq.cc @@ -78,16 +78,15 @@ namespace jaq { m_output ? "out" : "in"); // idiomatic suffix auto x = client::x_jack_port_by_name(mom->handle, port_name); - - snprintf - (reinterpret_cast(&port_name), - buffer_size, - "%s-%s", - new_name.c_str(), // desired port name - m_output ? "out" : "in"); // idiomatic suffix - - if (x == NULL) + if (x == NULL) { + snprintf + (reinterpret_cast(&port_name), + buffer_size, + "%s-%s", + new_name.c_str(), // desired port name + m_output ? "out" : "in"); // idiomatic suffix return client::x_jack_port_rename(mom->handle, handle, port_name) == 0; + } else return false; }