From ca5a342e9279eb865dafee487e72fac2db3138f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 4 Jan 2024 18:16:48 +0100 Subject: [PATCH] pw-link: use the `regex_t` objects in `struct data` --- src/tools/pw-link.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/tools/pw-link.c b/src/tools/pw-link.c index 32572a449..72aa58ad9 100644 --- a/src/tools/pw-link.c +++ b/src/tools/pw-link.c @@ -826,8 +826,6 @@ int main(int argc, char *argv[]) .opt_mode = MODE_CONNECT, }; int res = 0, c; - regex_t out_port_regex; - regex_t in_port_regex; static const struct option long_options[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, @@ -984,12 +982,12 @@ int main(int argc, char *argv[]) data.list_outputs = true; if (data.opt_output) { - if (regcomp(&out_port_regex, data.opt_output, REG_EXTENDED | REG_NOSUB) == 0) - data.out_regex = &out_port_regex; + if (regcomp(&data.out_port_regex, data.opt_output, REG_EXTENDED | REG_NOSUB) == 0) + data.out_regex = &data.out_port_regex; } if (data.opt_input) { - if (regcomp(&in_port_regex, data.opt_input, REG_EXTENDED | REG_NOSUB) == 0) - data.in_regex = &in_port_regex; + if (regcomp(&data.in_port_regex, data.opt_input, REG_EXTENDED | REG_NOSUB) == 0) + data.in_regex = &data.in_port_regex; } switch (data.opt_mode) {