From patchwork Tue Dec 7 06:47:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: GitHub pull_request - opened X-Patchwork-Id: 12661119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1857C433F5 for ; Tue, 7 Dec 2021 06:48:55 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 345DC231B; Tue, 7 Dec 2021 07:48:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 345DC231B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638859734; bh=p4ZxzOFwVIidvFo6CyDVe08u6SHPIlYryYcvzZr8krU=; h=From:To:In-Reply-To:References:Subject:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=f3CCll4vFvBny4Yw2P1EtKQCfnbFwh8oGl1sdE3HeDu6b8Fm2sXaBygiOlTQz51HL NzXbzLWdnFSpr+eH3sTrhCT4UqsO0nF18iJRH7DLt8jztuBRViJw6AdE0Gf0TsaaC1 MniK00fh2+wx44ip2dPhXDpryLpp5uNM/pZXtemw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 21339F80103; Tue, 7 Dec 2021 07:47:43 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F37B7F804AE; Tue, 7 Dec 2021 07:47:41 +0100 (CET) Received: from webhooks-bot.alsa-project.org (gate.perex.cz [77.48.224.242]) by alsa1.perex.cz (Postfix) with ESMTP id 5F096F80103 for ; Tue, 7 Dec 2021 07:47:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5F096F80103 MIME-Version: 1.0 From: GitHub issues - edited To: alsa-devel@alsa-project.org In-Reply-To: <1638859659063849926-webhooks-bot@alsa-project.org> References: <1638859659063849926-webhooks-bot@alsa-project.org> Subject: Add support for some non-alphanumeric variable names in the math expr evaluator Message-Id: <20211207064741.F37B7F804AE@alsa1.perex.cz> Date: Tue, 7 Dec 2021 07:47:41 +0100 (CET) X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: ``` ``` Issue URL : https://github.com/alsa-project/alsa-lib/issues/197 Repository URL: https://github.com/alsa-project/alsa-lib 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++; }