[libvirt] [PATCH] maint: drop spurious semicolons

I noticed a line 'int nparams = 0;;' in remote_dispatch.h, and tracked down where it was generated. While at it, I found a couple of other double semicolons. Additionally, I noticed that commit df0b57a95 left a stale reference to the file name remote_dispatch_bodies.h. * src/conf/numatune_conf.c (virDomainNumatuneNodeParseXML): Drop empty statement. * tests/virdbustest.c (testMessageStruct, testMessageSimple): Likewise. * src/rpc/gendispatch.pl (remote_dispatch_bodies.h): Likewise, and update stale comments. Signed-off-by: Eric Blake <eblake@redhat.com> --- Pushing under the trivial rule. Syntax check can't easily catch this, because we want to allow 'for (int i = 0;; i++)' on a loop that uses break to exit, so this is just done by manual inspection. src/conf/numatune_conf.c | 2 +- src/rpc/gendispatch.pl | 4 ++-- tests/virdbustest.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c index ff0f3eb..21d9a64 100644 --- a/src/conf/numatune_conf.c +++ b/src/conf/numatune_conf.c @@ -81,7 +81,7 @@ virDomainNumatuneNodeParseXML(virDomainNumatunePtr *numatunePtr, xmlXPathContextPtr ctxt) { char *tmp = NULL; - int n = 0;; + int n = 0; int ret = -1; size_t i = 0; virDomainNumatunePtr numatune = *numatunePtr; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index d820d0e..27093d2 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -380,7 +380,7 @@ if ($mode eq "debug") { } } -# Bodies for dispatch functions ("remote_dispatch_bodies.h"). +# Bodies for dispatch functions ("remote_dispatch.h"). elsif ($mode eq "server") { my %generate = map { $_ => 1 } @autogen; my @keys = sort (keys %calls); @@ -537,7 +537,7 @@ elsif ($mode eq "server") { push(@args_list, "args->$1.$1_len"); } elsif ($args_member =~ m/^remote_typed_param (\S+)<(\S+)>;/) { push(@vars_list, "virTypedParameterPtr $1 = NULL"); - push(@vars_list, "int n$1 = 0;"); + push(@vars_list, "int n$1 = 0"); if ($call->{ProcName} eq "NodeSetMemoryParameters") { push(@args_list, "priv->conn"); } diff --git a/tests/virdbustest.c b/tests/virdbustest.c index a798fbe..0079b41 100644 --- a/tests/virdbustest.c +++ b/tests/virdbustest.c @@ -62,7 +62,7 @@ static int testMessageSimple(const void *args ATTRIBUTE_UNUSED) unsigned int in_uint32 = 200000000, out_uint32 = 0; long long in_int64 = 1000000000000LL, out_int64 = 0; unsigned long long in_uint64 = 2000000000000LL, out_uint64 = 0; - double in_double = 3.14159265359, out_double = 0;; + double in_double = 3.14159265359, out_double = 0; const char *in_string = "Hello World"; char *out_string = NULL; const char *in_objectpath = "/org/libvirt/test"; @@ -338,7 +338,7 @@ static int testMessageStruct(const void *args ATTRIBUTE_UNUSED) unsigned int in_uint32 = 200000000, out_uint32 = 0; long long in_int64 = -1000000000000LL, out_int64 = 0; unsigned long long in_uint64 = 2000000000000LL, out_uint64 = 0; - double in_double = 3.14159265359, out_double = 0;; + double in_double = 3.14159265359, out_double = 0; const char *in_string = "Hello World"; char *out_string = NULL; const char *in_objectpath = "/org/libvirt/test"; -- 1.9.3

On Mon, Aug 25, 2014 at 04:31:07PM -0600, Eric Blake wrote:
I noticed a line 'int nparams = 0;;' in remote_dispatch.h, and tracked down where it was generated. While at it, I found a couple of other double semicolons. Additionally, I noticed that commit df0b57a95 left a stale reference to the file name remote_dispatch_bodies.h.
* src/conf/numatune_conf.c (virDomainNumatuneNodeParseXML): Drop empty statement. * tests/virdbustest.c (testMessageStruct, testMessageSimple): Likewise. * src/rpc/gendispatch.pl (remote_dispatch_bodies.h): Likewise, and update stale comments.
Signed-off-by: Eric Blake <eblake@redhat.com> ---
Pushing under the trivial rule.
Syntax check can't easily catch this, because we want to allow 'for (int i = 0;; i++)' on a loop that uses break to exit, so this is just done by manual inspection.
But trying ';;$' it looks like it can. And trying it out it seems there's still one place left. Before your patch: git ls-files | grep '\.[chx]' | xargs grep ';;$' src/conf/numatune_conf.c: int n = 0;; src/xenconfig/xen_common.c: return -1;; tests/virdbustest.c: double in_double = 3.14159265359, out_double = 0;; tests/virdbustest.c: double in_double = 3.14159265359, out_double = 0;; And after your patch: git ls-files | grep '\.[chx]' | xargs grep ';;$' src/xenconfig/xen_common.c: return -1;; Martin

On 08/25/2014 08:52 PM, Martin Kletzander wrote:
On Mon, Aug 25, 2014 at 04:31:07PM -0600, Eric Blake wrote:
I noticed a line 'int nparams = 0;;' in remote_dispatch.h, and tracked down where it was generated. While at it, I found a couple of other double semicolons. Additionally, I noticed that commit df0b57a95 left a stale reference to the file name remote_dispatch_bodies.h.
Syntax check can't easily catch this, because we want to allow 'for (int i = 0;; i++)' on a loop that uses break to exit, so this is just done by manual inspection.
But trying ';;$' it looks like it can. And trying it out it seems there's still one place left.
Oh cool, looks like I have a followup patch to write, then.
And after your patch: git ls-files | grep '\.[chx]' | xargs grep ';;$' src/xenconfig/xen_common.c: return -1;;
Martin
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Martin Kletzander