[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block |
Date: |
Tue, 15 Apr 2014 10:56:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Chen Gang <address@hidden> 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 <address@hidden>
> ---
> 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 <address@hidden>
- [Qemu-devel] [PATCH-trivial v2] vl: Report accelerator not supported for target more nicely, Chen Gang, 2014/04/04
- Re: [Qemu-devel] [PATCH-trivial v2] vl: Report accelerator not supported for target more nicely, Markus Armbruster, 2014/04/04
- Re: [Qemu-devel] [Qemu-trivial] [PATCH-trivial v2] vl: Report accelerator not supported for target more nicely, Michael Tokarev, 2014/04/06
- Re: [Qemu-devel] [Qemu-trivial] [PATCH-trivial v2] vl: Report accelerator not supported for target more nicely, Chen Gang, 2014/04/06
- [Qemu-devel] [PATCH trivial 0/3] vl: simplify code for main() and get_boot_device(), Chen Gang, 2014/04/08
- [Qemu-devel] [PATCH trivial 1/3] vl: remove useless 'continue', Chen Gang, 2014/04/08
- [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res', Chen Gang, 2014/04/08
- [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block, Chen Gang, 2014/04/08
- Re: [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block, Chen Gang, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block, Peter Crosthwaite, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block, Chen Gang, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res', Peter Crosthwaite, 2014/04/14
- Re: [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res', Chen Gang, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res', Markus Armbruster, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res', Chen Gang, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 1/3] vl: remove useless 'continue', Peter Crosthwaite, 2014/04/14
- Re: [Qemu-devel] [PATCH trivial 1/3] vl: remove useless 'continue', Chen Gang, 2014/04/15
- Re: [Qemu-devel] [PATCH trivial 1/3] vl: remove useless 'continue', Markus Armbruster, 2014/04/15