pw-link: use the regex_t objects in struct data

This commit is contained in:
Barnabás Pőcze 2024-01-04 18:16:48 +01:00 committed by Wim Taymans
parent 431a201d6c
commit ca5a342e92

View file

@ -826,8 +826,6 @@ int main(int argc, char *argv[])
.opt_mode = MODE_CONNECT, .opt_mode = MODE_CONNECT,
}; };
int res = 0, c; int res = 0, c;
regex_t out_port_regex;
regex_t in_port_regex;
static const struct option long_options[] = { static const struct option long_options[] = {
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
@ -984,12 +982,12 @@ int main(int argc, char *argv[])
data.list_outputs = true; data.list_outputs = true;
if (data.opt_output) { if (data.opt_output) {
if (regcomp(&out_port_regex, data.opt_output, REG_EXTENDED | REG_NOSUB) == 0) if (regcomp(&data.out_port_regex, data.opt_output, REG_EXTENDED | REG_NOSUB) == 0)
data.out_regex = &out_port_regex; data.out_regex = &data.out_port_regex;
} }
if (data.opt_input) { if (data.opt_input) {
if (regcomp(&in_port_regex, data.opt_input, REG_EXTENDED | REG_NOSUB) == 0) if (regcomp(&data.in_port_regex, data.opt_input, REG_EXTENDED | REG_NOSUB) == 0)
data.in_regex = &in_port_regex; data.in_regex = &data.in_port_regex;
} }
switch (data.opt_mode) { switch (data.opt_mode) {