From patchwork Wed Apr 8 16:30:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 6181391 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 16984BF4A6 for ; Wed, 8 Apr 2015 16:31:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BC782037D for ; Wed, 8 Apr 2015 16:31:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 38ADE2037A for ; Wed, 8 Apr 2015 16:31:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5FF202656FC; Wed, 8 Apr 2015 18:31:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 6D36C2654C9; Wed, 8 Apr 2015 18:31:20 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F04862654C3; Wed, 8 Apr 2015 18:31:18 +0200 (CEST) Received: from smtp311.phy.lolipop.jp (smtp311.phy.lolipop.jp [210.157.22.79]) by alsa0.perex.cz (Postfix) with ESMTP id 949F626545B for ; Wed, 8 Apr 2015 18:31:11 +0200 (CEST) Received: from smtp311.phy.lolipop.lan (HELO smtp311.phy.lolipop.jp) (172.17.1.11) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp311.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Thu, 09 Apr 2015 01:31:08 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp311.phy.lolipop.jp (LOLIPOP-Fsecure); Thu, 09 Apr 2015 01:30:59 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Thu, 9 Apr 2015 01:30:54 +0900 Message-Id: <1428510659-30393-2-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1428510659-30393-1-git-send-email-o-takashi@sakamocchi.jp> References: <1428510659-30393-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/5] amixer: gather local variables in the beginning of functions X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Following to basic principles of C language programing. Signed-off-by: Takashi Sakamoto --- amixer/amixer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/amixer/amixer.c b/amixer/amixer.c index 36c92eb..ff1a927 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -1278,13 +1278,16 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp) static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv) { - unsigned int idx, item = 0; + unsigned int idx; + unsigned int item = 0; int check_flag = ignore_error ? 0 : -1; + int ival; + char *ptr; for (idx = 1; idx < argc; idx++) { - char *ptr = argv[idx]; + ptr = argv[idx]; while (*ptr) { - int ival = get_enum_item_index(elem, &ptr); + ival = get_enum_item_index(elem, &ptr); if (ival < 0) return check_flag; if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0)