From d059cbc9a24c2087be34c1e39fcd53d0a6342f07 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 10 Nov 2015 20:34:46 +0000 Subject: [PATCH 3/5] resize: Use 'may' pattern in various places. This is upstream commit be1b9315ac79e866c4638b60997a48960959ff15, but only the parts that apply to virt-resize. --- resize/resize.ml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/resize/resize.ml b/resize/resize.ml index 7b03f07..5c881a9 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -1151,17 +1151,8 @@ read the man page virt-resize(1). if p.p_bootable then g#part_set_bootable "/dev/sdb" p.p_target_partnum true; - (match p.p_label with - | Some label -> - g#part_set_name "/dev/sdb" p.p_target_partnum label; - | None -> () - ); - - (match p.p_guid with - | Some guid -> - g#part_set_gpt_guid "/dev/sdb" p.p_target_partnum guid; - | None -> () - ); + may (g#part_set_name "/dev/sdb" p.p_target_partnum) p.p_label; + may (g#part_set_gpt_guid "/dev/sdb" p.p_target_partnum) p.p_guid; match parttype, p.p_id with | GPT, GPT_Type gpt_type -> -- 2.5.0