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

Eric Blake eblake at redhat.com
Thu Apr 11 17:59:50 UTC 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130411/09912871/attachment-0001.sig>


More information about the libvir-list mailing list