All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	Peter Maydell <peter.maydell@linaro.org>,
	Michael Tokarev <mjt@tls.msk.ru>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block
Date: Tue, 15 Apr 2014 19:09:13 +0800	[thread overview]
Message-ID: <534D1359.9040409@gmail.com> (raw)
In-Reply-To: <87d2gjgecy.fsf@blackfin.pond.sub.org>


On 04/15/2014 04:56 PM, Markus Armbruster wrote:
> Chen Gang <gang.chen.5i5j@gmail.com> 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.
> 

That sounds fine to me.

And excuse me, my English is not quite well (so may write confusing and
redundancy comments)

Thanks.
>>
>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>> ---
>>  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(&current_machine->init_args);
>>  
>>      audio_init();
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed


  reply	other threads:[~2014-04-15 11:09 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  1:16 [Qemu-devel] [PATCH] vl.c: use 'break' instead of 'continue' in configure_accelerator() Chen Gang
2014-03-27  7:55 ` Marcel Apfelbaum
2014-03-27  9:54   ` Chen Gang
2014-03-27  8:59 ` Markus Armbruster
2014-03-27 10:01   ` Chen Gang
2014-03-30 14:44     ` Chen Gang
2014-03-31 12:38       ` Markus Armbruster
2014-03-31 12:53         ` Chen Gang
2014-03-31 13:01           ` [Qemu-trivial] " Peter Maydell
2014-03-31 13:01             ` Peter Maydell
2014-03-31 13:12             ` [Qemu-trivial] " Chen Gang
2014-03-31 13:12               ` Chen Gang
2014-03-31 13:16               ` [Qemu-trivial] " Peter Maydell
2014-03-31 13:16                 ` Peter Maydell
2014-03-31 13:26                 ` [Qemu-trivial] " Chen Gang
2014-03-31 13:26                   ` Chen Gang
2014-03-31 13:33                   ` [Qemu-trivial] " Peter Maydell
2014-03-31 13:33                     ` Peter Maydell
2014-03-31 23:50                     ` [Qemu-trivial] " Chen Gang
2014-03-31 23:50                       ` Chen Gang
2014-04-04  9:39                     ` [Qemu-trivial] [PATCH-trivial v2] vl: Report accelerator not supported for target more nicely Chen Gang
2014-04-04  9:39                       ` [Qemu-devel] " Chen Gang
2014-04-04 10:57                       ` [Qemu-trivial] " Markus Armbruster
2014-04-04 10:57                         ` Markus Armbruster
2014-04-06 12:30                         ` [Qemu-trivial] " Chen Gang
2014-04-06 12:30                           ` Chen Gang
2014-04-06  6:32                       ` [Qemu-trivial] " Michael Tokarev
2014-04-06  6:32                         ` [Qemu-devel] " Michael Tokarev
2014-04-06 12:32                         ` Chen Gang
2014-04-06 12:32                           ` [Qemu-devel] " Chen Gang
2014-04-08 12:00                           ` [Qemu-trivial] [PATCH trivial 0/3] vl: simplify code for main() and get_boot_device() Chen Gang
2014-04-08 12:00                             ` [Qemu-devel] " Chen Gang
2014-04-08 12:01                             ` [Qemu-trivial] [PATCH trivial 1/3] vl: remove useless 'continue' Chen Gang
2014-04-08 12:01                               ` [Qemu-devel] " Chen Gang
2014-04-08 12:02                               ` [Qemu-trivial] [PATCH trivial 2/3] vl: remove redundant local variable 'res' Chen Gang
2014-04-08 12:02                                 ` [Qemu-devel] " Chen Gang
2014-04-08 12:05                                 ` [Qemu-trivial] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block Chen Gang
2014-04-08 12:05                                   ` [Qemu-devel] " Chen Gang
2014-04-15  8:56                                   ` [Qemu-trivial] " Markus Armbruster
2014-04-15 11:09                                     ` Chen Gang [this message]
2014-04-15 12:29                                   ` Peter Crosthwaite
2014-04-15 12:33                                     ` Chen Gang
2014-04-15  2:13                                 ` [Qemu-trivial] [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res' Peter Crosthwaite
2014-04-15  4:50                                   ` Chen Gang
2014-04-15  8:43                                   ` Markus Armbruster
2014-04-15 11:03                                     ` Chen Gang
2014-04-15  2:11                               ` [Qemu-trivial] [Qemu-devel] [PATCH trivial 1/3] vl: remove useless 'continue' Peter Crosthwaite
2014-04-15  4:41                                 ` Chen Gang
2014-04-15  8:50                               ` Markus Armbruster
2014-04-15 11:05                                 ` Chen Gang
2014-04-16  2:56                                   ` liang ding
2014-04-15  0:37                             ` [Qemu-trivial] [PATCH trivial 0/3] vl: simplify code for main() and get_boot_device() Chen Gang
2014-04-15  8:49                             ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2014-04-15 13:54                               ` Chen Gang
2014-04-15 14:51                                 ` Markus Armbruster
2014-04-15 23:08                                   ` Chen Gang

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=534D1359.9040409@gmail.com \
    --to=gang.chen.5i5j@gmail.com \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.