Pino Toscano
2014-May-29 08:49 UTC
[Libguestfs] [PATCH] generator: fix daemon functions with optional params but no mandatory params
The
struct guestfs_$function_args args;
declaration was not emitted in that case, leading to build failure.
---
generator/c.ml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/generator/c.ml b/generator/c.ml
index ee276dc..1fa05ab 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -1658,9 +1658,9 @@ and generate_client_actions hash () let
args_passed_to_daemon List.filter (function FileIn _ | FileOut _ ->
false | _ -> true)
args in
- (match args_passed_to_daemon with
- | [] -> ()
- | _ -> pr " struct guestfs_%s_args args;\n" name
+ (match args_passed_to_daemon, optargs with
+ | [], [] -> ()
+ | _, _ -> pr " struct guestfs_%s_args args;\n" name
);
pr " guestfs_message_header hdr;\n";
--
1.9.3
Richard W.M. Jones
2014-May-29 11:00 UTC
Re: [Libguestfs] [PATCH] generator: fix daemon functions with optional params but no mandatory params
On Thu, May 29, 2014 at 10:49:57AM +0200, Pino Toscano wrote:> The > struct guestfs_$function_args args; > declaration was not emitted in that case, leading to build failure. > --- > generator/c.ml | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/generator/c.ml b/generator/c.ml > index ee276dc..1fa05ab 100644 > --- a/generator/c.ml > +++ b/generator/c.ml > @@ -1658,9 +1658,9 @@ and generate_client_actions hash () > let args_passed_to_daemon > List.filter (function FileIn _ | FileOut _ -> false | _ -> true) > args in > - (match args_passed_to_daemon with > - | [] -> () > - | _ -> pr " struct guestfs_%s_args args;\n" name > + (match args_passed_to_daemon, optargs with > + | [], [] -> () > + | _, _ -> pr " struct guestfs_%s_args args;\n" name > );This is fine. struct guestfs_*_args is supposed to be suppressed when there are no arguments at all. However if there are optional arguments, then this struct is needed. Therefore: ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top