Displaying 9 results from an estimated 9 matches for "remove_dup".
Did you mean:
remove_dups
2016 Sep 23
2
[PATCH 1/2] mllib: move remove_duplicates from v2v
...s changed, 15 insertions(+), 12 deletions(-)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 81d8202..78618f5 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -297,6 +297,15 @@ let sort_uniq ?(cmp = Pervasives.compare) xs =
let xs = uniq ~cmp xs in
xs
+let remove_duplicates xs =
+ let h = Hashtbl.create (List.length xs) in
+ let rec loop = function
+ | [] -> []
+ | x :: xs when Hashtbl.mem h x -> xs
+ | x :: xs -> Hashtbl.add h x true; x :: loop xs
+ in
+ loop xs
+
let push_back xsp x = xsp := !xsp @ [x]
let push_front x xsp = xsp := x :...
2016 Sep 23
0
[PATCH 2/2] dib: use remove_duplicates instead of own code
...iles changed, 1 insertion(+), 5 deletions(-)
diff --git a/dib/cmdline.ml b/dib/cmdline.ml
index 1fd6c71..144e5a7 100644
--- a/dib/cmdline.ml
+++ b/dib/cmdline.ml
@@ -107,7 +107,7 @@ read the man page virt-dib(1).
let formats = ref ["qcow2"] in
let set_format arg =
- let fmts = remove_dups (String.nsplit "," arg) in
+ let fmts = remove_duplicates (String.nsplit "," arg) in
List.iter (
function
| "qcow2" | "tar" | "raw" | "vhd" | "docker" -> ()
diff --git a/dib/utils.ml b/dib/utils.ml
index...
2016 Aug 02
2
[PATCH] mllib: move which and its exception from dib
...t\"
diff --git a/dib/utils.ml b/dib/utils.ml
index f316264..a2046cb 100644
--- a/dib/utils.ml
+++ b/dib/utils.ml
@@ -21,8 +21,6 @@ open Common_utils
open Printf
-exception Tool_not_found of string (* tool *)
-
let quote = Filename.quote
let unit_GB howmany =
@@ -97,21 +95,9 @@ let rec remove_dups = function
| [] -> []
| x :: xs -> x :: (remove_dups (List.filter ((<>) x) xs))
-let which tool =
- let paths = String.nsplit ":" (Sys.getenv "PATH") in
- let paths = filter_map (
- fun p ->
- let path = p // tool in
- try Unix.access path...
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
..._arg = function
| [ "auto" ] ->
diff --git a/dib/cmdline.ml b/dib/cmdline.ml
index e2f2ded..4aa6a53 100644
--- a/dib/cmdline.ml
+++ b/dib/cmdline.ml
@@ -78,7 +78,7 @@ read the man page virt-dib(1).
let formats = ref ["qcow2"] in
let set_format arg =
- let fmts = remove_dups (string_nsplit "," arg) in
+ let fmts = remove_dups (String.nsplit "," arg) in
List.iter (
function
| "qcow2" | "tar" | "raw" | "vhd" -> ()
@@ -123,7 +123,7 @@ read the man page virt-dib(1).
let extra_package...
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase.
These are replaced by safe functions that won't break UTF-8 strings.
Other miscellaneous refactoring.
Rich.
2015 May 29
0
[PATCH v3] RFC: New virt-dib tool
...ze = ref None in
+ let set_memsize arg = memsize := Some arg in
+
+ let network = ref true in
+
+ let smp = ref None in
+ let set_smp arg = smp := Some arg in
+
+ let formats = ref ["qcow2"] in
+ let set_format arg =
+ let fmts = string_nsplit "," arg in
+ let fmts = remove_dups fmts in
+ List.iter (
+ function
+ | "qcow2" | "tar" | "raw" | "vhd" -> ()
+ | fmt ->
+ error (f_"invalid format '%s' in --formats") fmt
+ ) fmts;
+ formats := fmts in
+
+ let envvars = ref [] in
+ let...
2015 Jul 03
1
[PATCH v5] New tool: virt-dib
...size arg = size := parse_size arg in
+
+ let memsize = ref None in
+ let set_memsize arg = memsize := Some arg in
+
+ let network = ref true in
+
+ let smp = ref None in
+ let set_smp arg = smp := Some arg in
+
+ let formats = ref ["qcow2"] in
+ let set_format arg =
+ let fmts = remove_dups (string_nsplit "," arg) in
+ List.iter (
+ function
+ | "qcow2" | "tar" | "raw" | "vhd" -> ()
+ | fmt ->
+ error (f_"invalid format '%s' in --formats") fmt
+ ) fmts;
+ formats := fmts in
+
+ l...
2015 Mar 31
0
[PATCH] WIP: New virt-dib tool
...ze = ref None in
+ let set_memsize arg = memsize := Some arg in
+
+ let network = ref true in
+
+ let smp = ref None in
+ let set_smp arg = smp := Some arg in
+
+ let formats = ref ["qcow2"] in
+ let set_format arg =
+ let fmts = string_nsplit "," arg in
+ let fmts = remove_dups fmts in
+ List.iter (
+ function
+ | "qcow2" | "tar" | "raw" -> ()
+ | fmt ->
+ error (f_"invalid format '%s' in --formats") fmt
+ ) fmts;
+ formats := fmts in
+
+ let envvars = ref [] in
+ let append_envvar arg...
2015 Jun 16
2
[PATCH v4] RFC: New tool: virt-dib
...size arg = size := parse_size arg in
+
+ let memsize = ref None in
+ let set_memsize arg = memsize := Some arg in
+
+ let network = ref true in
+
+ let smp = ref None in
+ let set_smp arg = smp := Some arg in
+
+ let formats = ref ["qcow2"] in
+ let set_format arg =
+ let fmts = remove_dups (string_nsplit "," arg) in
+ List.iter (
+ function
+ | "qcow2" | "tar" | "raw" | "vhd" -> ()
+ | fmt ->
+ error (f_"invalid format '%s' in --formats") fmt
+ ) fmts;
+ formats := fmts in
+
+ l...