]> git.alsa-project.org Git - alsa-utils.git/commitdiff
topology: pre-processor: fix regular expression flags
authorChao Song <chao.song@linux.intel.com>
Mon, 13 Mar 2023 05:38:37 +0000 (13:38 +0800)
committerJaroslav Kysela <perex@perex.cz>
Wed, 3 May 2023 14:25:15 +0000 (16:25 +0200)
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>
topology/pre-processor.c

index 38bb87b51c390ce0a15fcc1b763cde036195b5ce..3f2025235672d0ae1e0e4a915cfa160092e7e7a4 100644 (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)
                        continue;
 
-               ret = regcomp(&regex, id, 0);
+               ret = regcomp(&regex, id, REG_EXTENDED | REG_ICASE);
                if (ret) {
                        fprintf(stderr, "Could not compile regex\n");
                        goto err;
                }
 
                /* Execute regular expression */
-               ret = regexec(&regex, value, 0, NULL, REG_ICASE);
+               ret = regexec(&regex, value, 0, NULL, 0);
                if (ret)
                        continue;