[Libguestfs] [PATCH 1/2] gobject: Allow RConstOptString to return an error

Richard W.M. Jones rjones at redhat.com
Thu Jan 26 08:46:28 UTC 2012


On Wed, Jan 25, 2012 at 05:19:41PM +0000, Matthew Booth wrote:
> @@ -780,7 +776,7 @@ let generate_gobject_c_methods () =
>  
>        (* Check return, throw error if necessary, marshall return value *)
>  
> -      if returns_error ret then (
> +      if match ret with RConstOptString _ -> false | _ -> true then (
>          pr "  if (ret == %s) {\n"
>            (match ret with
>            | RErr | RInt _ | RInt64 _ | RBool _ ->

This is a bit of a mouthful.  You can just write:

  match ret with
  | RConstOptString _ -> ()
  | _ ->
    pr (* etc *)

However the rest of the patch is fine, so ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list