topology: pre-processor: fix regular expression flags

The REG_ICASE flag is a compile-time flag (cflags), it
should be used with regcomp() instead of regexec(). Also
add the REG_EXTENDED flag in this patch to make patterns
like 'tgl|adl' work.

Fixes: https://github.com/alsa-project/alsa-utils/pull/195
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Chao Song 2023-03-13 13:38:37 +08:00 committed by Jaroslav Kysela
parent ca503e3519
commit 52f6fb7f33

View file

@ -493,14 +493,14 @@ static int pre_process_include_conf(struct tplg_pre_processor *tplg_pp, snd_conf
if (snd_config_get_id(n, &id) < 0) if (snd_config_get_id(n, &id) < 0)
continue; continue;
ret = regcomp(&regex, id, 0); ret = regcomp(&regex, id, REG_EXTENDED | REG_ICASE);
if (ret) { if (ret) {
fprintf(stderr, "Could not compile regex\n"); fprintf(stderr, "Could not compile regex\n");
goto err; goto err;
} }
/* Execute regular expression */ /* Execute regular expression */
ret = regexec(&regex, value, 0, NULL, REG_ICASE); ret = regexec(&regex, value, 0, NULL, 0);
if (ret) if (ret)
continue; continue;