[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 12 of 12] Refactoring slightly the function "Restrictions.to_compact_string" for readability
# HG changeset patch # User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx> # Date 1265041877 0 # Node ID acbf8750e962fabb2ac3437e1bad829ef96398c7 # Parent ed3d292016d805d42d591f6a0baf8c6e94969582 Refactoring slightly the function "Restrictions.to_compact_string" for readability. Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx> diff -r ed3d292016d8 -r acbf8750e962 ocaml/license/restrictions.ml --- a/ocaml/license/restrictions.ml Mon Feb 01 16:31:16 2010 +0000 +++ b/ocaml/license/restrictions.ml Mon Feb 01 16:31:17 2010 +0000 @@ -59,23 +59,28 @@ } (** Used for printing compact host x restriction tables *) -let to_compact_string (x: restrictions) = - (if x.enable_vlans then "VLAN " else " " ) ^ - (if x.enable_qos then "QoS " else " " ) ^ - (if x.enable_shared_storage then "SStorage " else " ") ^ - (if x.enable_netapp then "NTAP " else " " ) ^ - (if x.enable_equalogic then "EQL " else " " ) ^ - (if x.enable_pooling then "Pool " else " " ) ^ - (if x.enable_xha then "XHA " else " " ) ^ - (if x.enable_mtc_pci then "MTC " else " " ) ^ - (if x.enable_email then "email " else " " ) ^ - (if x.enable_performance then "perf " else " " ) ^ - (if x.enable_wlb then "WLB " else " " ) ^ - (if x.enable_rbac then "RBAC " else " " ) ^ - (if x.enable_dmc then "DMC " else " " ) ^ - (if x.restrict_connection then " " else "Cnx " ) ^ - (if x.platform_filter then " " else "Plat " ) ^ - (if x.regular_nag_dialog then " nag " else " " ) +let to_compact_string (x: restrictions) = + let tag_flag_pair_list = [ + "VLAN" , x.enable_vlans ; + "QoS" , x.enable_qos ; + "SStorage", x.enable_shared_storage; + "NTAP" , x.enable_netapp ; + "EQL" , x.enable_equalogic ; + "Pool" , x.enable_pooling ; + "XHA" , x.enable_xha ; + "MTC" , x.enable_mtc_pci ; + "email" , x.enable_email ; + "perf" , x.enable_performance ; + "WLB" , x.enable_wlb ; + "RBAC" , x.enable_rbac ; + "DMC" , x.enable_dmc ; + "Cnx" , not x.restrict_connection ; + "Plat" , not x.platform_filter ; + "nag" , x.regular_nag_dialog ; + ] in + let to_string (tag, flag) = + if flag then tag else String.make (String.length tag) ' ' in + String.concat " " (List.map to_string tag_flag_pair_list) (** Represents no restrictions at all *) let most_permissive = { 1 file changed, 22 insertions(+), 17 deletions(-) ocaml/license/restrictions.ml | 39 ++++++++++++++++++++++----------------- Attachment:
xen-api.hg-12.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |