>From 93e5540667e459b59ddb5ad8c31d48e7499d352a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 8 Jul 2016 09:17:21 +0100 Subject: [PATCH] mllib: Rename unshift -> push_front, push -> push_back etc. The C++ function names are more regular. Updates commit 1c57c71d46dae2c61c393c32ec85a7022c95f818. --- builder/builder.ml | 2 +- builder/cmdline.ml | 8 +++---- builder/downloader.ml | 4 ++-- builder/languages.ml | 6 +++--- builder/sigchecker.ml | 2 +- customize/customize_main.ml | 4 ++-- dib/cmdline.ml | 10 ++++----- generator/customize.ml | 20 ++++++++--------- mllib/common_utils.ml | 8 +++---- mllib/common_utils.mli | 42 +++++++++++++++++++----------------- resize/resize.ml | 4 ++-- sparsify/cmdline.ml | 4 ++-- sysprep/main.ml | 2 +- sysprep/sysprep_operation.ml | 4 ++-- sysprep/sysprep_operation_script.ml | 2 +- v2v/OVF.ml | 8 +++---- v2v/cmdline.ml | 6 +++--- v2v/convert_linux.ml | 10 ++++----- v2v/convert_windows.ml | 2 +- v2v/copy_to_local.ml | 10 ++++----- v2v/input_libvirtxml.ml | 8 +++---- v2v/input_ova.ml | 6 +++--- v2v/modules_list.ml | 6 +++--- v2v/output_libvirt.ml | 6 +++--- v2v/test-harness/v2v_test_harness.ml | 6 +++--- v2v/vCenter.ml | 6 +++--- 26 files changed, 99 insertions(+), 97 deletions(-) diff --git a/builder/builder.ml b/builder/builder.ml index 6754d9f..b513ca3 100644 --- a/builder/builder.ml +++ b/builder/builder.ml @@ -405,7 +405,7 @@ let main () = let is_not t = not (is t) in let remove = List.remove_assoc in let ret = ref [] in - let tr task weight otags = unshift (task, weight, otags) ret in + let tr task weight otags = push_front (task, weight, otags) ret in (* XXX Weights are not very smartly chosen. At the moment I'm * using a range [0..100] where 0 = free and 100 = expensive. We diff --git a/builder/cmdline.ml b/builder/cmdline.ml index 93ac179..6085b45 100644 --- a/builder/cmdline.ml +++ b/builder/cmdline.ml @@ -71,7 +71,7 @@ let parse_cmdline () = | "auto" -> attach_format := None | s -> attach_format := Some s in - let attach_disk s = unshift (!attach_format, s) attach in + let attach_disk s = push_front (!attach_format, s) attach in let cache = ref Paths.xdg_cache_home in let set_cache arg = cache := Some arg in @@ -83,7 +83,7 @@ let parse_cmdline () = let delete_on_failure = ref true in let fingerprints = ref [] in - let add_fingerprint arg = unshift arg fingerprints in + let add_fingerprint arg = push_front arg fingerprints in let format = ref "" in let gpg = ref "gpg" in @@ -113,7 +113,7 @@ let parse_cmdline () = let set_smp arg = smp := Some arg in let sources = ref [] in - let add_source arg = unshift arg sources in + let add_source arg = push_front arg sources in let sync = ref true in let warn_if_partition = ref true in @@ -175,7 +175,7 @@ let parse_cmdline () = let argspec = set_standard_options argspec in let args = ref [] in - let anon_fun s = unshift s args in + let anon_fun s = push_front s args in let usage_msg = sprintf (f_"\ %s: build virtual machine images quickly diff --git a/builder/downloader.ml b/builder/downloader.ml index 5bd8e3d..c164450 100644 --- a/builder/downloader.ml +++ b/builder/downloader.ml @@ -125,10 +125,10 @@ and download_to t ?(progress_bar = false) ~proxy uri filename = (* Now download the file. *) let curl_h = let curl_args = ref common_args in - push curl_args ("output", Some filename_new); + push_back curl_args ("output", Some filename_new); if not (verbose ()) then ( - if progress_bar then push curl_args ("progress-bar", None) + if progress_bar then push_back curl_args ("progress-bar", None) else append curl_args quiet_args ); diff --git a/builder/languages.ml b/builder/languages.ml index 5e1d70a..9dca697 100644 --- a/builder/languages.ml +++ b/builder/languages.ml @@ -30,10 +30,10 @@ let split_locale loc = let territory = match_or_empty 3 in (match territory with | "" -> () - | territory -> unshift (lang ^ "_" ^ territory) l); - unshift lang l; + | territory -> push_front (lang ^ "_" ^ territory) l); + push_front lang l; ); - unshift "" l; + push_front "" l; List.rev !l let languages () = diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml index e2a3b5f..c1cc1f3 100644 --- a/builder/sigchecker.ml +++ b/builder/sigchecker.ml @@ -80,7 +80,7 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile = (match !current with | None -> () | Some k -> - if String.is_suffix id k then unshift id subkeys; + if String.is_suffix id k then push_front id subkeys; current := None ) | _ -> () diff --git a/customize/customize_main.ml b/customize/customize_main.ml index 6b58aea..3681b32 100644 --- a/customize/customize_main.ml +++ b/customize/customize_main.ml @@ -38,7 +38,7 @@ let main () = | "auto" -> attach_format := None | s -> attach_format := Some s in - let attach_disk s = unshift (!attach_format, s) attach in + let attach_disk s = push_front (!attach_format, s) attach in let domain = ref None in let dryrun = ref false in let files = ref [] in @@ -62,7 +62,7 @@ let main () = error (f_"error parsing URI '%s'. Look for error messages printed above.") arg in let format = match !format with "auto" -> None | fmt -> Some fmt in - unshift (uri, format) files; + push_front (uri, format) files; format_consumed := true and set_domain dom = if !domain <> None then diff --git a/dib/cmdline.ml b/dib/cmdline.ml index f51a20d..ec4ebba 100644 --- a/dib/cmdline.ml +++ b/dib/cmdline.ml @@ -68,16 +68,16 @@ read the man page virt-dib(1). prog in let elements = ref [] in - let append_element element = unshift element elements in + let append_element element = push_front element elements in let excluded_elements = ref [] in - let append_excluded_element element = unshift element excluded_elements in + let append_excluded_element element = push_front element excluded_elements in let element_paths = ref [] in - let append_element_path arg = unshift arg element_paths in + let append_element_path arg = push_front arg element_paths in let excluded_scripts = ref [] in - let append_excluded_script arg = unshift arg excluded_scripts in + let append_excluded_script arg = push_front arg excluded_scripts in let debug = ref 0 in let set_debug arg = @@ -114,7 +114,7 @@ read the man page virt-dib(1). formats := fmts in let envvars = ref [] in - let append_envvar arg = unshift arg envvars in + let append_envvar arg = push_front arg envvars in let use_base = ref true in diff --git a/generator/customize.ml b/generator/customize.ml index b4b12c4..8caf2b5 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -653,7 +653,7 @@ let rec argspec () = op_shortdesc = shortdesc; op_pod_longdesc = longdesc } -> pr " (\n"; pr " \"--%s\",\n" name; - pr " Arg.Unit (fun () -> unshift %s ops),\n" discrim; + pr " Arg.Unit (fun () -> push_front %s ops),\n" discrim; pr " \" \" ^ s_\"%s\"\n" shortdesc; pr " ),\n"; pr " None, %S;\n" longdesc @@ -661,7 +661,7 @@ let rec argspec () = op_shortdesc = shortdesc; op_pod_longdesc = longdesc } -> pr " (\n"; pr " \"--%s\",\n" name; - pr " Arg.String (fun s -> unshift (%s s) ops),\n" discrim; + pr " Arg.String (fun s -> push_front (%s s) ops),\n" discrim; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; pr " Some %S, %S;\n" v longdesc @@ -672,7 +672,7 @@ let rec argspec () = pr " Arg.String (\n"; pr " fun s ->\n"; pr " let p = split_string_pair \"%s\" s in\n" name; - pr " unshift (%s p) ops\n" discrim; + pr " push_front (%s p) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -684,7 +684,7 @@ let rec argspec () = pr " Arg.String (\n"; pr " fun s ->\n"; pr " let ss = split_string_list s in\n"; - pr " unshift (%s ss) ops\n" discrim; + pr " push_front (%s ss) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -696,7 +696,7 @@ let rec argspec () = pr " Arg.String (\n"; pr " fun s ->\n"; pr " let ss = split_links_list \"%s\" s in\n" name; - pr " unshift (%s ss) ops\n" discrim; + pr " push_front (%s ss) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -708,7 +708,7 @@ let rec argspec () = pr " Arg.String (\n"; pr " fun s ->\n"; pr " let sel = Password.parse_selector s in\n"; - pr " unshift (%s sel) ops\n" discrim; + pr " push_front (%s sel) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -721,7 +721,7 @@ let rec argspec () = pr " fun s ->\n"; pr " let user, sel = split_string_pair \"%s\" s in\n" name; pr " let sel = Password.parse_selector sel in\n"; - pr " unshift (%s (user, sel)) ops\n" discrim; + pr " push_front (%s (user, sel)) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -734,7 +734,7 @@ let rec argspec () = pr " fun s ->\n"; pr " let user, selstr = String.split \":\" s in\n"; pr " let sel = Ssh_key.parse_selector selstr in\n"; - pr " unshift (%s (user, sel)) ops\n" discrim; + pr " push_front (%s (user, sel)) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -746,7 +746,7 @@ let rec argspec () = pr " Arg.String (\n"; pr " fun s ->\n"; pr " %s s;\n" fn; - pr " unshift (%s s) ops\n" discrim; + pr " push_front (%s s) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; @@ -758,7 +758,7 @@ let rec argspec () = pr " Arg.String (\n"; pr " fun s ->\n"; pr " let sel = Subscription_manager.parse_pool_selector s in\n"; - pr " unshift (%s sel) ops\n" discrim; + pr " push_front (%s sel) ops\n" discrim; pr " ),\n"; pr " s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc; pr " ),\n"; diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index 40a19bc..9660692 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -282,16 +282,16 @@ let sort_uniq ?(cmp = Pervasives.compare) xs = let xs = uniq ~cmp xs in xs -let push xsp x = xsp := !xsp @ [x] -let unshift x xsp = xsp := x :: !xsp -let pop xsp = +let push_back xsp x = xsp := !xsp @ [x] +let push_front x xsp = xsp := x :: !xsp +let pop_back xsp = let x, xs = match List.rev !xsp with | x :: xs -> x, xs | [] -> failwith "pop" in xsp := List.rev xs; x -let shift xsp = +let pop_front xsp = let x, xs = match !xsp with | x :: xs -> x, xs diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 97c7d9f..44b3018 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -141,40 +141,42 @@ val uniq : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list (** Sort and uniquify a list. *) -val push : 'a list ref -> 'a -> unit -val unshift : 'a -> 'a list ref -> unit -val pop : 'a list ref -> 'a -val shift : 'a list ref -> 'a -(** Imperative list manipulation functions, similar to the Perl - functions described in http://perlmaven.com/manipulating-perl-arrays +val push_back : 'a list ref -> 'a -> unit +val push_front : 'a -> 'a list ref -> unit +val pop_back : 'a list ref -> 'a +val pop_front : 'a list ref -> 'a +(** Imperative list manipulation functions, similar to C++ STL + functions with the same names. (Although the names are similar, + the computational complexity of the functions is quite different.) These operate on list references, and each function modifies the list reference that is passed to it. - [push xsp x] appends the element [x] to the end of the list [xsp]. - This function is not tail-recursive. + [push_back xsp x] appends the element [x] to the end of the list + [xsp]. This function is not tail-recursive. - [unshift x xsp] prepends the element [x] to the head of the list [xsp]. - (The arguments are reversed compared to the same Perl function, but - OCaml is type safe so that's OK.) + [push_front x xsp] prepends the element [x] to the head of the + list [xsp]. (The arguments are reversed compared to the same Perl + function, but OCaml is type safe so that's OK.) - [pop xsp] removes the last element of the list [xsp] and returns it. - The list is modified to become the list minus the final element. - If a zero-length list is passed in, this raises [Failure "pop"]. - This function is not tail-recursive. + [pop_back xsp] removes the last element of the list [xsp] and + returns it. The list is modified to become the list minus the + final element. If a zero-length list is passed in, this raises + [Failure "pop_back"]. This function is not tail-recursive. - [shift xsp] removes the head element of the list [xsp] and returns it. - The list is modified to become the tail of the list. If a zero-length - list is passed in, this raises [Failure "shift"]. *) + [pop_front xsp] removes the head element of the list [xsp] and + returns it. The list is modified to become the tail of the list. + If a zero-length list is passed in, this raises [Failure + "pop_front"]. *) val append : 'a list ref -> 'a list -> unit val prepend : 'a list -> 'a list ref -> unit (** More imperative list manipulation functions. - [append] is like {!push} above, except it appends a list to + [append] is like {!push_back} above, except it appends a list to the list reference. This function is not tail-recursive. - [prepend] is like {!unshift} above, except it prepends a list + [prepend] is like {!push_front} above, except it prepends a list to the list reference. *) val may : ('a -> unit) -> 'a option -> unit diff --git a/resize/resize.ml b/resize/resize.ml index fb98c17..f92f1b7 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -150,7 +150,7 @@ let main () = lv_expands, machine_readable, ntfsresize_force, output_format, resizes, resizes_force, shrink, sparse, unknown_fs_mode = - let add xs s = unshift s xs in + let add xs s = push_front s xs in let align_first = ref "auto" in let alignment = ref 128 in @@ -214,7 +214,7 @@ let main () = ] in let argspec = set_standard_options argspec in let disks = ref [] in - let anon_fun s = unshift s disks in + let anon_fun s = push_front s disks in let usage_msg = sprintf (f_"\ %s: resize a virtual machine disk diff --git a/sparsify/cmdline.ml b/sparsify/cmdline.ml index 1855fa6..0c12f8e 100644 --- a/sparsify/cmdline.ml +++ b/sparsify/cmdline.ml @@ -41,7 +41,7 @@ and mode_t = and check_t = [`Ignore|`Continue|`Warn|`Fail] let parse_cmdline () = - let add xs s = unshift s xs in + let add xs s = push_front s xs in let check_tmpdir = ref `Warn in let set_check_tmpdir = function @@ -79,7 +79,7 @@ let parse_cmdline () = ] in let argspec = set_standard_options argspec in let disks = ref [] in - let anon_fun s = unshift s disks in + let anon_fun s = push_front s disks in let usage_msg = sprintf (f_"\ %s: sparsify a virtual machine disk diff --git a/sysprep/main.ml b/sysprep/main.ml index c8db653..7922b43 100644 --- a/sysprep/main.ml +++ b/sysprep/main.ml @@ -56,7 +56,7 @@ let main () = with Invalid_argument "URI.parse_uri" -> error (f_"error parsing URI '%s'. Look for error messages printed above.") arg in let format = match !format with "auto" -> None | fmt -> Some fmt in - unshift (uri, format) files; + push_front (uri, format) files; format_consumed := true and set_domain dom = if !domain <> None then diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml index 806e9d8..73020d5 100644 --- a/sysprep/sysprep_operation.ml +++ b/sysprep/sysprep_operation.ml @@ -109,9 +109,9 @@ let remove_all_from_set set = empty_set let register_operation op = - unshift op all_operations; + push_front op all_operations; if op.enabled_by_default then - unshift op enabled_by_default_operations + push_front op enabled_by_default_operations let baked = ref false let rec bake () = diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml index f7f6e88..4b3748c 100644 --- a/sysprep/sysprep_operation_script.ml +++ b/sysprep/sysprep_operation_script.ml @@ -33,7 +33,7 @@ let set_scriptdir dir = scriptdir := Some dir let scripts = ref [] -let add_script script = unshift script scripts +let add_script script = push_front script scripts let rec script_perform (g : Guestfs.guestfs) root side_effects = let scripts = List.rev !scripts in diff --git a/v2v/OVF.ml b/v2v/OVF.ml index 97b2928..bcffee9 100644 --- a/v2v/OVF.ml +++ b/v2v/OVF.ml @@ -294,7 +294,7 @@ let rec create_ovf source targets guestcaps inspect (match origin_of_source_hypervisor source.s_hypervisor with | None -> () | Some origin -> - push content_subnodes (e "Origin" [] [PCData (string_of_int origin)]) + push_back content_subnodes (e "Origin" [] [PCData (string_of_int origin)]) ); append content_subnodes [ @@ -469,7 +469,7 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = (match actual_size_gb with | None -> () | Some actual_size_gb -> - push attrs ("ovf:actual_size", Int64.to_string actual_size_gb) + push_back attrs ("ovf:actual_size", Int64.to_string actual_size_gb) ); e "Disk" !attrs [] in if is_estimate then ( @@ -500,7 +500,7 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = e "rasd:last_modified_date" [] [PCData iso_time]; ] in if is_bootable_drive then - push item_subnodes + push_back item_subnodes (e "BootOrder" [] [PCData (string_of_int boot_order)]); e "Item" [] !item_subnodes in @@ -556,7 +556,7 @@ and add_networks nics guestcaps ovf = (match mac with | None -> () | Some mac -> - push item_subnodes + push_back item_subnodes (e "rasd:MACAddress" [] [PCData mac]) ); e "Item" [] !item_subnodes in diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index 558ace4..1a729ca 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -150,10 +150,10 @@ let parse_cmdline () = in let vdsm_image_uuids = ref [] in - let add_vdsm_image_uuid s = unshift s vdsm_image_uuids in + let add_vdsm_image_uuid s = push_front s vdsm_image_uuids in let vdsm_vol_uuids = ref [] in - let add_vdsm_vol_uuid s = unshift s vdsm_vol_uuids in + let add_vdsm_vol_uuid s = push_front s vdsm_vol_uuids in let vmtype_warning _ = warning (f_"the --vmtype option has been removed and now does nothing") @@ -216,7 +216,7 @@ let parse_cmdline () = ] in let argspec = set_standard_options argspec in let args = ref [] in - let anon_fun s = unshift s args in + let anon_fun s = push_front s args in let usage_msg = sprintf (f_"\ %s: convert a guest to use KVM diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 90f9543..e8bb0d3 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -555,13 +555,13 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = List.iter ( fun { G.app2_name = name } -> if String.is_prefix name "vmware-tools-libraries-" then - unshift name libraries + push_front name libraries else if String.is_prefix name "vmware-tools-" then - unshift name remove + push_front name remove else if name = "VMwareTools" then - unshift name remove + push_front name remove else if String.is_prefix name "kmod-vmware-tools" then - unshift name remove + push_front name remove ) inspect.i_apps; let libraries = !libraries in @@ -601,7 +601,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = let cmd = Array.of_list cmd in (try ignore (g#command cmd); - unshift library remove + push_front library remove with G.Error msg -> eprintf "%s: could not install replacement for %s. Error was: %s. %s was not removed.\n" prog library msg library diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml index 34fe9cb..55bb3ef 100644 --- a/v2v/convert_windows.ml +++ b/v2v/convert_windows.ml @@ -196,7 +196,7 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = * uninstaller still shows a no-way-out reboot dialog *) " PREVENT_REBOOT=Yes LAUNCHED_BY_SETUP_EXE=Yes" in - unshift uninst uninsts + push_front uninst uninsts with Not_found -> () ) uninstnodes diff --git a/v2v/copy_to_local.ml b/v2v/copy_to_local.ml index 3f2f09c..1811dca 100644 --- a/v2v/copy_to_local.ml +++ b/v2v/copy_to_local.ml @@ -48,7 +48,7 @@ let rec main () = ] in let argspec = set_standard_options argspec in let args = ref [] in - let anon_fun s = unshift s args in + let anon_fun s = push_front s args in let usage_msg = sprintf (f_"\ %s: copy a remote guest to the local machine @@ -202,12 +202,12 @@ read the man page virt-v2v-copy-to-local(1). "url", Some remote_disk; "output", Some local_disk; ] in - if not sslverify then push curl_args ("insecure", None); + if not sslverify then push_back curl_args ("insecure", None); (match cookie with | None -> () - | Some cookie -> push curl_args ("cookie", Some cookie) + | Some cookie -> push_back curl_args ("cookie", Some cookie) ); - if quiet () then push curl_args ("silent", None); + if quiet () then push_back curl_args ("silent", None); let curl_h = Curl.create !curl_args in if verbose () then @@ -258,7 +258,7 @@ and parse_libvirt_xml guest_name xml = incr i; let local_disk = sprintf "%s-disk%d" guest_name !i in - unshift (remote_disk, local_disk) disks; + push_front (remote_disk, local_disk) disks; local_disk in get_disks, add_disk diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml index a1fa96a..146e5c6 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -76,7 +76,7 @@ let parse_libvirt_xml ?conn xml = let nr_nodes = Xml.xpathobj_nr_nodes obj in for i = 0 to nr_nodes-1 do let node = Xml.xpathobj_node obj i in - unshift (Xml.node_name node) features + push_front (Xml.node_name node) features done; !features in @@ -193,7 +193,7 @@ let parse_libvirt_xml ?conn xml = let get_disks () = List.rev !disks in let add_disk qemu_uri format controller p_source = incr i; - unshift + push_front { p_source_disk = { s_disk_id = !i; s_qemu_uri = qemu_uri; s_format = format; s_controller = controller }; @@ -335,7 +335,7 @@ let parse_libvirt_xml ?conn xml = { s_removable_type = typ; s_removable_controller = controller; s_removable_slot = slot } in - unshift disk disks + push_front disk disks done; List.rev !disks in @@ -379,7 +379,7 @@ let parse_libvirt_xml ?conn xml = s_vnet_orig = vnet; s_vnet_type = vnet_type } in - unshift nic nics + push_front nic nics in match xpath_string "source/@network | source/@bridge" with | None -> () diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index f3d35c4..13c18b2 100644 --- a/v2v/input_ova.ml +++ b/v2v/input_ova.ml @@ -287,7 +287,7 @@ object s_format = Some "vmdk"; s_controller = controller; } in - unshift disk disks; + push_front disk disks; ) else error (f_"could not parse disk rasd:HostResource from OVF document") done in @@ -331,7 +331,7 @@ object s_removable_controller = controller; s_removable_slot = slot; } in - unshift disk removables; + push_front disk removables; done in let removables = List.rev !removables in @@ -351,7 +351,7 @@ object s_vnet_orig = vnet; s_vnet_type = Network; } in - unshift nic nics + push_front nic nics done; let source = { diff --git a/v2v/modules_list.ml b/v2v/modules_list.ml index 30b044e..36a08c0 100644 --- a/v2v/modules_list.ml +++ b/v2v/modules_list.ml @@ -21,8 +21,8 @@ open Common_utils let input_modules = ref [] and output_modules = ref [] -let register_input_module name = unshift name input_modules -and register_output_module name = unshift name output_modules +let register_input_module name = push_front name input_modules +and register_output_module name = push_front name output_modules let input_modules () = List.sort compare !input_modules and output_modules () = List.sort compare !output_modules @@ -35,7 +35,7 @@ type conversion_fn = let convert_modules = ref [] let register_convert_module inspect_fn name conversion_fn = - unshift (inspect_fn, (name, conversion_fn)) convert_modules + push_front (inspect_fn, (name, conversion_fn)) convert_modules let find_convert_module inspect = let rec loop = function diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml index 750c64d..d1e9346 100644 --- a/v2v/output_libvirt.ml +++ b/v2v/output_libvirt.ml @@ -64,7 +64,7 @@ let target_features_of_capabilities_doc doc arch = for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do let feature_node = Xml.xpathobj_node obj i in let feature_name = Xml.node_name feature_node in - unshift feature_name features + push_front feature_name features done; !features ) @@ -237,7 +237,7 @@ let create_libvirt_xml ?pool source target_buses guestcaps | Cirrus -> e "model" [ "type", "cirrus"; "vram", "9216" ] [] in append_attr ("heads", "1") video_model; e "video" [] [ video_model ] in - push devices video; + push_back devices video; let graphics = match source.s_display with @@ -273,7 +273,7 @@ let create_libvirt_xml ?pool source target_buses guestcaps | Some { s_port = None } | None -> append_attr ("autoport", "yes") graphics; append_attr ("port", "-1") graphics); - push devices graphics; + push_back devices graphics; let sound = match source.s_sound with diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml index f774978..35730e3 100644 --- a/v2v/test-harness/v2v_test_harness.ml +++ b/v2v/test-harness/v2v_test_harness.ml @@ -94,7 +94,7 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () = let nodes_of_xpathobj doc xpathobj = let nodes = ref [] in for i = 0 to Xml.xpathobj_nr_nodes xpathobj - 1 do - unshift (Xml.xpathobj_node xpathobj i) nodes + push_front (Xml.xpathobj_node xpathobj i) nodes done; List.rev !nodes in @@ -210,7 +210,7 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () = printf "%s\n%!" cmd; let chan = open_process_in cmd in let lines = ref [] in - (try while true do unshift (input_line chan) lines done + (try while true do push_front (input_line chan) lines done with End_of_file -> ()); let lines = List.rev !lines in let stat = close_process_in chan in @@ -283,7 +283,7 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () = printf "%s\n%!" cmd; let chan = open_process_in cmd in let lines = ref [] in - (try while true do unshift (input_line chan) lines done + (try while true do push_front (input_line chan) lines done with End_of_file -> ()); let lines = List.rev !lines in let stat = close_process_in chan in diff --git a/v2v/vCenter.ml b/v2v/vCenter.ml index f534a6d..91efd79 100644 --- a/v2v/vCenter.ml +++ b/v2v/vCenter.ml @@ -55,11 +55,11 @@ let get_session_cookie password scheme uri sslverify url = | None, Some _ -> warning (f_"--password-file parameter ignored because 'user@' was not given in the URL") | Some user, None -> - push curl_args ("user", Some user) + push_back curl_args ("user", Some user) | Some user, Some password -> - push curl_args ("user", Some (user ^ ":" ^ password)) + push_back curl_args ("user", Some (user ^ ":" ^ password)) ); - if not sslverify then push curl_args ("insecure", None); + if not sslverify then push_back curl_args ("insecure", None); let curl_h = Curl.create !curl_args in let lines = Curl.run curl_h in -- 2.7.4