alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: GitHub issues - edited <github@alsa-project.org>
To: alsa-devel@alsa-project.org
Subject: Add support for some non-alphanumeric variable names in the math expr evaluator
Date: Tue,  7 Dec 2021 07:47:41 +0100 (CET)	[thread overview]
Message-ID: <20211207064741.F37B7F804AE@alsa1.perex.cz> (raw)
In-Reply-To: <1638859659063849926-webhooks-bot@alsa-project.org>

alsa-project/alsa-lib issue #197 was edited from ranj063:

The math expression evaluator expects variable names to only be alpha-numeric. So if I have something like "[$DYNAMIC_PIPELINE + 2]", I get the error:

ALSA lib confeval.c:263:(snd_config_evaluate_string) wrong expression '$[$DYNAMIC_PIPELINE + 2]'
ALSA lib conf.c:5632:(snd_config_expand_custom) Expand error (walk): Invalid argument
Failed to expand pre-processor definitions in input config

Is it possible to add support for some non-alphanumeric characters in the variable names , esp '_'? I tried this change it seems to suffice:
```
diff --git a/src/confeval.c b/src/confeval.c
index a971bf38..7330d67e 100644
--- a/src/confeval.c
+++ b/src/confeval.c
@@ -190,7 +190,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
                        } else {
                                e = s + 1;
                                while (*e) {
-                                       if (!isalnum(*e))
+                                       if (!isalnum(*e) && (*e != '_'))
                                                break;
                                        e++;
                                }

```

Issue URL     : https://github.com/alsa-project/alsa-lib/issues/197
Repository URL: https://github.com/alsa-project/alsa-lib

       reply	other threads:[~2021-12-07  6:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1638859659063849926-webhooks-bot@alsa-project.org>
2021-12-07  6:47 ` GitHub issues - edited [this message]
     [not found] <1638859636214114904-webhooks-bot@alsa-project.org>
2021-12-07  6:47 ` Add support for some non-alphanumeric variable names in the math expr evaluator GitHub issues - edited
     [not found] <1638859531323084116-webhooks-bot@alsa-project.org>
2021-12-07  6:45 ` GitHub issues - opened

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211207064741.F37B7F804AE@alsa1.perex.cz \
    --to=github@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).