Re: [PATCH v2 1/2] Remove extraneous comma in info_cpu_stats and opts_cpu_stats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/08/2013 09:35 AM, John Ferlan wrote:
> ---
>  tools/virsh-domain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index c088468..e6e6877 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -6111,7 +6111,7 @@ static const vshCmdInfo info_cpu_stats[] = {
>      {.name = "desc",
>       .data = N_("Display per-CPU and total statistics about the domain's CPUs")
>      },
> -    {.name = NULL},
> +    {.name = NULL}

No semantic difference, only a matter of which style is more consistent.

I generally LIKE trailing commas, _if the enum or struct is designed for
extension_, because it is nicer to see a diff adding an element like this:

   oldelt1,
   oldelt2,
+  newelt,
 }

than it is like this:
   oldelt1,
-  oldelt2
+  oldelt2,
+  newlt
 }

But here, the {.name = NULL} is a sentinel, and we will NEVER add an
element after it, so a trailing comma no longer buys us anything.  [Any
additions we make would be before the sentinel, and there we are
guaranteed to already have a comma because the sentinel still has to
come last].  On that argument, this patch is fine.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]