Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WZzB9-0007Ue-Nt for mharc-qemu-trivial@gnu.org; Tue, 15 Apr 2014 04:57:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZzB1-0007Cd-CP for qemu-trivial@nongnu.org; Tue, 15 Apr 2014 04:57:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZzAv-0005hJ-7q for qemu-trivial@nongnu.org; Tue, 15 Apr 2014 04:57:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZzAi-0005e9-9b; Tue, 15 Apr 2014 04:56:52 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3F8umrE030755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Apr 2014 04:56:48 -0400 Received: from blackfin.pond.sub.org (ovpn-116-48.ams2.redhat.com [10.36.116.48]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3F8ukw7021919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Apr 2014 04:56:47 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E0AD6200D1; Tue, 15 Apr 2014 10:56:45 +0200 (CEST) From: Markus Armbruster To: Chen Gang References: <53337BEB.90305@gmail.com> <87wqfgrp83.fsf@blackfin.pond.sub.org> <5333F6E2.9080202@gmail.com> <53382DDD.8050001@gmail.com> <87fvlylf02.fsf@blackfin.pond.sub.org> <53396545.805@gmail.com> <533969AB.4010505@gmail.com> <53396CE9.9090405@gmail.com> <533E7DD5.3090203@gmail.com> <5340F4FD.7040305@msgid.tls.msk.ru> <53414941.5040908@gmail.com> <5343E4D4.6070305@gmail.com> <5343E516.3020103@gmail.com> <5343E571.60407@gmail.com> <5343E5ED.2040906@gmail.com> Date: Tue, 15 Apr 2014 10:56:45 +0200 In-Reply-To: <5343E5ED.2040906@gmail.com> (Chen Gang's message of "Tue, 08 Apr 2014 20:05:01 +0800") Message-ID: <87d2gjgecy.fsf@blackfin.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: QEMU Trivial , Peter Maydell , Michael Tokarev , QEMU Developers , Anthony Liguori Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Apr 2014 08:57:17 -0000 Chen Gang writes: > For C code, it does not recommend to define a local variable in the > middle of code block without "{...}". The original author may want to > zero members not mentioned in structure assignment. > > So recommend to use structure initializing block "{...}" for structure > assignment in the middle of code block. > > And at present, we can assume that all related gcc versions will be > latest enough to notice about this grammar. Commit message is a bit confusing :) I'd write something like this: vl: Eliminate a superfluous local variable CODING_STYLE frowns upon mixing declarations and statements. main() has such a declaration. Clean up by eliminating the variable. > > Signed-off-by: Chen Gang > --- > vl.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/vl.c b/vl.c > index 377f962..d381443 100644 > --- a/vl.c > +++ b/vl.c > @@ -4368,15 +4368,15 @@ int main(int argc, char **argv, char **envp) > > qdev_machine_init(); > > - QEMUMachineInitArgs args = { .machine = machine, > - .ram_size = ram_size, > - .boot_order = boot_order, > - .kernel_filename = kernel_filename, > - .kernel_cmdline = kernel_cmdline, > - .initrd_filename = initrd_filename, > - .cpu_model = cpu_model }; > - > - current_machine->init_args = args; > + current_machine->init_args = (QEMUMachineInitArgs) { > + .machine = machine, > + .ram_size = ram_size, > + .boot_order = boot_order, > + .kernel_filename = kernel_filename, > + .kernel_cmdline = kernel_cmdline, > + .initrd_filename = initrd_filename, > + .cpu_model = cpu_model }; > + > machine->init(¤t_machine->init_args); > > audio_init(); Reviewed-by: Markus Armbruster