Received: by 10.223.164.202 with SMTP id h10csp1829094wrb; Mon, 27 Nov 2017 08:02:00 -0800 (PST) X-Google-Smtp-Source: AGs4zMZnc+v7eXfI180GTpUZZln1PphZD0g6qw++nEvvuPPpcnqClcUHcxmr1LNOmdRl1OsROLNR X-Received: by 10.84.254.69 with SMTP id a5mr11209701pln.353.1511798520211; Mon, 27 Nov 2017 08:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511798520; cv=none; d=google.com; s=arc-20160816; b=mSpx0CPexVPTp0FG8sGmm0p2AJY0L0S/qpLLorvfEA/BWY4MEsgeQk4xJcd7MZbSJ9 Yltc+4/bbfedsJaxbHD0rmXkQtaqaXDI3uoUh2PIbM46xvsgvatj8Xwcx6WTVO/5axAK T5GUS8Kw4rr7Er1m2F/kGhuBd2sMxqSfT+kn3nIi75EQRLuycr/DiOW5dyNzfbFu8kN1 X/d/t21gcBjfAaUUA6/fwQtF9cE/OzqX8TdcLs+SE2HtejC4Zcqcou1yP1YWcxGzjJR3 XE+487Y+EySvyacK4DLwVjZiiBepJkmAnf+WXTciy1Dbt1cGNG7KjRYAU2z1Kj55G5RJ atyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:reply-to:from:date :message-id:arc-authentication-results; bh=TSglsKZVb9NonnSZoe0I7VvmQHhFQdgs1kQYJKXLSe4=; b=0q4FiZuoaty1Dsg0ZANGXbTwzCA8dGTtSFNXrjw6JEJJ1FhHrOTlN7gB060e1jtDZZ 4idBMzud9Kl7ypVxW4FtFd9gNacdgMrxNs39GeKU1h0YmUTYeXhtckmJL24r4/mzKbIt EbMON9hrUB5euziI7aWbibaufIPVz4booXZUd2bdNiitlpRrbEzOAA2h4Qk3tTIInxZb ck1fAJomnMy/oab6cDP/Sc4jpSFL8kd5wxWl/Ueih0I012+I6pVJom5qx77i0dCAQ0sx /cJEr63BBBAOaZauvFN9htbEKpKDykXOfTPb8/abfu9EmAGkMzjgFs3CeUkgA8d6rTJR jdHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o67si1551195pga.624.2017.11.27.08.01.48; Mon, 27 Nov 2017 08:02:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752842AbdK0QAI (ORCPT + 78 others); Mon, 27 Nov 2017 11:00:08 -0500 Received: from mx02-sz.bfs.de ([194.94.69.103]:10581 "EHLO mx02-sz.bfs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752470AbdK0QAH (ORCPT ); Mon, 27 Nov 2017 11:00:07 -0500 Received: from localhost (localhost [127.0.0.1]) by mx02-sz.bfs.de (Postfix) with ESMTP id 5960F471; Mon, 27 Nov 2017 17:00:05 +0100 (CET) X-Virus-Scanned: amavisd-new at bfs.de Received: from mx02-sz.bfs.de ([127.0.0.1]) by localhost (mx02-sz.bfs.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XERrOU4F7tpj; Mon, 27 Nov 2017 17:00:04 +0100 (CET) Received: from mail-fr.bfs.de (mail-fr.bfs.de [10.177.18.200]) by mx02-sz.bfs.de (Postfix) with ESMTPS; Mon, 27 Nov 2017 17:00:04 +0100 (CET) Received: from [134.92.181.33] (unknown [134.92.181.33]) by mail-fr.bfs.de (Postfix) with ESMTPS id 886DABEE58; Mon, 27 Nov 2017 17:00:03 +0100 (CET) Message-ID: <5A1C3683.7080901@bfs.de> Date: Mon, 27 Nov 2017 17:00:03 +0100 From: walter harms Reply-To: wharms@bfs.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 To: Joe Perches CC: Colin King , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: drivers: make array 'names' const, reduces object code size References: <20171127125851.10076-1-colin.king@canonical.com> <5A1C2760.1030704@bfs.de> <1511797207.32426.41.camel@perches.com> In-Reply-To: <1511797207.32426.41.camel@perches.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 27.11.2017 16:40, schrieb Joe Perches: > On Mon, 2017-11-27 at 15:55 +0100, walter harms wrote: >> Am 27.11.2017 13:58, schrieb Colin King: >>> From: Colin Ian King >>> Don't populate array 'names' on the stack but instead make them static. >>> Makes the object code smaller by 50 bytes: > [] >>> diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c > [] >>> @@ -830,7 +830,7 @@ static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el >>> static int snd_dummy_iobox_info(struct snd_kcontrol *kcontrol, >>> struct snd_ctl_elem_info *info) >>> { >>> - const char *const names[] = { "None", "CD Player" }; >>> + static const char *const names[] = { "None", "CD Player" }; >>> >>> return snd_ctl_enum_info(info, 1, 2, names); >>> } >> >> nitpick: while here >> snd_ctl_enum_info(info, 1, ARRAY_SIZE(names), names); >> >> just my 2 cents, > > True, but that seems counter style for most uses of snd_ctl_enum_info > > $ git grep -w snd_ctl_enum_info | grep -v ARRAY_SIZE | wc -l > 159 > $ git grep -w snd_ctl_enum_info | grep ARRAY_SIZE | wc -l > 10 > > but most of those seem to choose variable amounts of a single > array. Here, ARRAY_SIZE seems better to me too. I will not argue. I was curious about the magic numbers and int this case it seems an obvious choice in other cases it may be wrong i did not and i will not investigate. re, wh > > For another real nitpick, please prefer "const *" over "const*" > > $ git grep -P "\*\s+const\b" | wc -l > 7068 > $ git grep -P "\*const\b" | wc -l > 1801 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > From 1585234327704152450@xxx Mon Nov 27 15:41:03 +0000 2017 X-GM-THRID: 1585224222397066978 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread