---
builder/builder.ml | 8 +++-----
builder/index.ml | 35 +++++++----------------------------
builder/list_entries.ml | 10 ++--------
3 files changed, 12 insertions(+), 41 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index 2c51550..b0fef48 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -626,8 +626,8 @@ let main () =
let g =
let g = open_guestfs () in
- (match memsize with None -> () | Some memsize -> g#set_memsize memsize);
- (match smp with None -> () | Some smp -> g#set_smp smp);
+ may g#set_memsize memsize;
+ may g#set_smp smp;
g#set_network network;
(* Make sure to turn SELinux off to avoid awkward interactions
@@ -733,8 +733,6 @@ let main () =
Pervasives.flush Pervasives.stdout;
Pervasives.flush Pervasives.stderr;
- match stats with
- | None -> ()
- | Some stats -> print_string stats
+ may print_string stats
let () = run_main_and_handle_errors main
diff --git a/builder/index.ml b/builder/index.ml
index c59d6dd..b2bc08e 100644
--- a/builder/index.ml
+++ b/builder/index.ml
@@ -63,20 +63,11 @@ let print_entry chan (name, { printable_name = printable_name;
hidden = hidden }) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
- (match printable_name with
- | None -> ()
- | Some name -> fp "name=%s\n" name
- );
- (match osinfo with
- | None -> ()
- | Some id -> fp "osinfo=%s\n" id
- );
+ may (fp "name=%s\n") printable_name;
+ may (fp "osinfo=%s\n") osinfo;
fp "file=%s\n" file_uri;
fp "arch=%s\n" arch;
- (match signature_uri with
- | None -> ()
- | Some uri -> fp "sig=%s\n" uri
- );
+ may (fp "sig=%s\n") signature_uri;
(match checksums with
| None -> ()
| Some checksums ->
@@ -87,23 +78,11 @@ let print_entry chan (name, { printable_name = printable_name;
) checksums
);
fp "revision=%s\n" (string_of_revision revision);
- (match format with
- | None -> ()
- | Some format -> fp "format=%s\n" format
- );
+ may (fp "format=%s\n") format;
fp "size=%Ld\n" size;
- (match compressed_size with
- | None -> ()
- | Some size -> fp "compressed_size=%Ld\n" size
- );
- (match expand with
- | None -> ()
- | Some expand -> fp "expand=%s\n" expand
- );
- (match lvexpand with
- | None -> ()
- | Some lvexpand -> fp "lvexpand=%s\n" lvexpand
- );
+ may (fp "compressed_size=%Ld\n") compressed_size;
+ may (fp "expand=%s\n") expand;
+ may (fp "lvexpand=%s\n") lvexpand;
List.iter (
fun (lang, notes) ->
match lang with
diff --git a/builder/list_entries.ml b/builder/list_entries.ml
index 4bb899c..2f053e8 100644
--- a/builder/list_entries.ml
+++ b/builder/list_entries.ml
@@ -35,10 +35,7 @@ and list_entries_short index =
if not hidden then (
printf "%-24s" name;
printf " %-10s" arch;
- (match printable_name with
- | None -> ()
- | Some s -> printf " %s" s
- );
+ may (printf " %s") printable_name;
printf "\n"
)
) index
@@ -69,10 +66,7 @@ and list_entries_long ~sources index =
hidden = hidden }) ->
if not hidden then (
printf "%-24s %s\n" "os-version:" name;
- (match printable_name with
- | None -> ()
- | Some name -> printf "%-24s %s\n" (s_"Full name:") name;
- );
+ may (printf "%-24s %s\n" (s_"Full name:")) printable_name;
printf "%-24s %s\n" (s_"Architecture:") arch;
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size
size);
(match compressed_size with
--
2.5.0