Pino Toscano
2014-Jan-22 22:22 UTC
[Libguestfs] [PATCH] builder: small code simplification
No actual behaviour changes, just remove extra match statements.
---
builder/list_entries.ml | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/builder/list_entries.ml b/builder/list_entries.ml
index 742e43b..0d3d9b2 100644
--- a/builder/list_entries.ml
+++ b/builder/list_entries.ml
@@ -98,13 +98,11 @@ and list_entries_json ~sources index | c ->
String.make 1 c)
done;
!res in
- let json_optional_printf_string key value - match value with
+ let json_optional_printf_string key = function
| None -> ()
| Some str ->
printf " \"%s\": \"%s\",\n" key
(json_string_escape str) in
- let json_optional_printf_int64 key value - match value with
+ let json_optional_printf_int64 key = function
| None -> ()
| Some n ->
printf " \"%s\": \"%Ld\",\n" key n in
--
1.8.3.1
Richard W.M. Jones
2014-Jan-22 22:40 UTC
Re: [Libguestfs] [PATCH] builder: small code simplification
On Wed, Jan 22, 2014 at 11:22:48PM +0100, Pino Toscano wrote:> No actual behaviour changes, just remove extra match statements. > --- > builder/list_entries.ml | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/builder/list_entries.ml b/builder/list_entries.ml > index 742e43b..0d3d9b2 100644 > --- a/builder/list_entries.ml > +++ b/builder/list_entries.ml > @@ -98,13 +98,11 @@ and list_entries_json ~sources index > | c -> String.make 1 c) > done; > !res in > - let json_optional_printf_string key value > - match value with > + let json_optional_printf_string key = function > | None -> () > | Some str -> > printf " \"%s\": \"%s\",\n" key (json_string_escape str) in > - let json_optional_printf_int64 key value > - match value with > + let json_optional_printf_int64 key = function > | None -> () > | Some n -> > printf " \"%s\": \"%Ld\",\n" key n in > -- > 1.8.3.1ACK. 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#)