Displaying 16 results from an estimated 16 matches for "dropwhile".
2016 Dec 09
2
Re: [PATCH 2/2] v2v: Fix ambiguous and probably incorrect pattern match (warning 57).
On Thursday, 8 December 2016 13:54:04 CET Richard W.M. Jones wrote:
> See:
> http://caml.inria.fr/pub/docs/manual-ocaml/comp.html#ss%3Awarn57
>
> I believe the code as written previously was incorrect. However we
> are lucky because if neither clause matches then it will fall through
> to displaying an error message, allowing the user to correct the
> problem.
> ---
>
2017 Nov 21
2
[PATCH v3 0/2] common/mlstdutils: Extend the List module.
v2 -> v3:
- Renamed List.assoc_ -> List.assoc_lbl.
- Rebased on top of current master branch.
Rich.
2017 Oct 08
4
[PATCH 0/3] common/mlstdutils: Add Std_utils List and Option modules.
In Std_utils we already extend Char and String. These commits take it
a little further by extending List and adding a new Option submodule.
All basically simple refactoring.
Rich.
2017 Oct 08
7
[[PATCH v2 0/4] common/mlstdutils: Add Std_utils List and Option modules.
This time including the first commit ...
2015 Nov 17
0
[PATCH 2/3] v2v: windows: Add a Windows '*.inf' file parser.
...nt in
+
+ (* Split the file into section headers + section content. *)
+ let rec loop = function
+ | [] -> []
+ | header :: xs when match_section_header header ->
+ let header = Str.matched_group 1 header in
+ let lines = takewhile not_section_header xs in
+ let ys = dropwhile not_section_header xs in
+ (header, lines) :: loop ys
+ | xs ->
+ (* Put all initial lines before the first section into a
+ * section with no name.
+ *)
+ let lines = takewhile not_section_header xs in
+ let ys = dropwhile not_section_header xs in
+...
2016 Dec 09
0
Re: [PATCH 2/2] v2v: Fix ambiguous and probably incorrect pattern match (warning 57).
..._vdsm.ml
+++ b/v2v/output_vdsm.ml
@@ -81,10 +81,9 @@ object
let mp, uuid =
let fields = String.nsplit "/" os in (* ... "data-center" "UUID" *)
let fields = List.rev fields in (* "UUID" "data-center" ... *)
+ let fields = dropwhile ((=) "") fields in
match fields with
- | "" :: uuid :: rest (* handles trailing "/" case *)
- | uuid :: rest
- when String.length uuid = 36 ->
+ | uuid :: rest when String.length uuid = 36 ->
let mp = String...
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...apSpace)
+ else if String.unsafe_get str i = '\n' then (i, WrapNL)
+ else _wrap_find_next_break (i+1) len str
+
+and output_spaces chan n = for i = 0 to n-1 do output_char chan ' ' done
+
+let (|>) x f = f x
+
+(* Drop elements from a list while a predicate is true. *)
+let rec dropwhile f = function
+ | [] -> []
+ | x :: xs when f x -> dropwhile f xs
+ | xs -> xs
+
+(* Take elements from a list while a predicate is true. *)
+let rec takewhile f = function
+ | x :: xs when f x -> x :: takewhile f xs
+ | _ -> []
+
+let rec filter_map f = function
+ | [] -> []...
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...| WrapNL
let rec wrap ?(chan = stdout) ?(indent = 0) str =
@@ -237,6 +304,8 @@ and _wrap_find_next_break i len str =
and output_spaces chan n = for i = 0 to n-1 do output_char chan ' ' done
+let (|>) x f = f x
+
(* Drop elements from a list while a predicate is true. *)
let rec dropwhile f = function
| [] -> []
@@ -255,6 +324,13 @@ let rec filter_map f = function
| Some y -> y :: filter_map f xs
| None -> filter_map f xs
+let rec find_map f = function
+ | [] -> raise Not_found
+ | x :: xs ->
+ match f x with
+ | Some y -> y
+ |...
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...bstring buf str start (len-start);
- len+1
- in
- let endi = loop 0 len in
- let line = Buffer.contents buf in
- if endi > len then
- [line]
- else
- line :: string_lines_split (String.sub str endi (len-endi))
-
(* Drop elements from a list while a predicate is true. *)
let rec dropwhile f = function
| [] -> []
@@ -527,14 +519,15 @@ let long_options = ref ([] : (Arg.key * Arg.spec * Arg.doc) list)
let display_short_options () =
List.iter (
fun (arg, _, _) ->
- if string_prefix arg "-" && not (string_prefix arg "--") then
+ if...
2017 Jun 19
16
[PATCH v7 00/13] Refactor utilities
This is just the utilities part of the patch series from:
https://www.redhat.com/archives/libguestfs/2017-June/msg00103.html
I believe this addresses everything raised in comments on that
patch series.
Rich.
2015 Nov 17
8
[PATCH 0/3] v2v: windows: Use '*.inf' files to control how Windows drivers are installed.
https://github.com/rwmjones/libguestfs/tree/rewrite-virtio-copy-drivers
Instead of trying to split and parse elements from virtio-win paths,
use the '*.inf' files supplied with the drivers to control how Windows
drivers are installed.
The following emails best explain how this works:
https://www.redhat.com/archives/libguestfs/2015-October/msg00352.html
2017 Jun 09
12
[PATCH 00/12] Refactor utility functions.
This turned out to be rather more involved than I thought.
We have lots of utility functions, spread all over the repository,
with not a lot of structure. This moves many of them under common/
and structures them so there are clear dependencies.
This doesn't complete the job by any means. Other items I had on my
to-do list for this change were:
- Split up mllib/common_utils into:
-
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.
2017 Jun 12
32
[PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
This is a combination of:
https://www.redhat.com/archives/libguestfs/2017-June/msg00046.html
[PATCH 00/12] Refactor utility functions.
plus:
https://www.redhat.com/archives/libguestfs/2017-June/msg00023.html
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
with the second patches rebased on top of the utility refactoring, and
some other adjustments and extensions.
This passes
2017 Jun 15
45
[PATCH v6 00/41] Refactor utilities, reimplement inspection in the daemon.
v5:
https://www.redhat.com/archives/libguestfs/2017-June/msg00065.html
Since v5, this now implements inspection almost completely for Linux
and Windows guests.
Rich.
2017 Jun 21
45
[PATCH v8 00/42] Refactor utilities and reimplement inspection.
v7 was:
https://www.redhat.com/archives/libguestfs/2017-June/msg00169.html
https://www.redhat.com/archives/libguestfs/2017-June/msg00184.html
I believe this addresses all comments received so far.
Also it now passes a test where I compared about 100 disk images
processed with old and new virt-inspector binaries. The output is
identical in all cases except one which is caused by a bug in blkid