Displaying 20 results from an estimated 22 matches for "unsafe_set".
Did you mean:
unsafe_get
2016 Jun 15
3
[PATCH 2/3] Convert source so it can be compiled with OCaml '-safe-string' option.
OCaml 4.02 introduced the 'bytes' type, a mutable string intended to
replace the existing 'string' type for those cases where the byte
array can be mutated. In future the 'string' type will become
immutable. This is not the default now, but it can be forced using
the '-safe-string' compile option.
I tested this on Fedora 24 (OCaml 4.02) & RHEL 7 (OCaml 4.01).
2017 Nov 21
3
[PATCH 0/3] Small improvements and fixes to urandom.
Small improvements and fixes to urandom.
2016 Aug 25
1
[PATCH 1.32] mllib: Add String.map function for OCaml < 4.00.0.
Same patch as just posted, but this is the modified version
required for the stable-1.32 branch.
Rich.
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.
2016 Jun 14
1
[PATCH] generator: Remove unnecessary 'chars' function.
...enerator/utils.ml
@@ -356,14 +356,7 @@ let pod2text ?width ?(trim = true) ?(discard = true) name longdesc =
(* Compare two actions (for sorting). *)
let action_compare { name = n1 } { name = n2 } = compare n1 n2
-let chars c n =
- let str = String.create n in
- for i = 0 to n-1 do
- String.unsafe_set str i c
- done;
- str
-
-let spaces n = chars ' ' n
+let spaces n = String.make n ' '
let args_of_optargs optargs =
List.map (
diff --git a/generator/utils.mli b/generator/utils.mli
index aec1f71..41dd47d 100644
--- a/generator/utils.mli
+++ b/generator/utils.mli
@@ -123,9 +...
2016 Aug 25
1
[PATCH] mllib: Add String.map function for OCaml < 4.00.0.
...n_utils.ml
index 9210cf8..4e36d50 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -38,6 +38,14 @@ end
module String = struct
include String
+ let map f s =
+ let len = String.length s in
+ let b = Bytes.create len in
+ for i = 0 to len-1 do
+ Bytes.unsafe_set b i (f (unsafe_get s i))
+ done;
+ Bytes.to_string b
+
let lowercase_ascii s = map Char.lowercase_ascii s
let uppercase_ascii s = map Char.uppercase_ascii s
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index 4959de6..de95f9d 100644
--- a/mllib/common_utils.mli...
2015 Oct 06
0
[PATCH 3/5] mllib: Add (Char|String).(lower|upper)case_ascii functions.
...afe_chr : int -> char
val uppercase : char -> char
+
+ val lowercase_ascii : char -> char
+ val uppercase_ascii : char -> char
end
(** Override the Char module from stdlib. *)
@@ -58,6 +61,9 @@ module String : sig
val unsafe_get : string -> int -> char
val unsafe_set : string -> int -> char -> unit
val uppercase : string -> string
+
+ val lowercase_ascii : string -> string
+ val uppercase_ascii : string -> string
end
(** Override the String module from stdlib. *)
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index...
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...; 13
+ | 'e' | 'E' -> 14
+ | 'f' | 'F' -> 15
+ | _ -> -1
+end
+
+module String = struct
+ include String
+
+ let map f s =
+ let len = String.length s in
+ let b = Bytes.create len in
+ for i = 0 to len-1 do
+ Bytes.unsafe_set b i (f (unsafe_get s i))
+ done;
+ Bytes.to_string b
+
+ let lowercase_ascii s = map Char.lowercase_ascii s
+ let uppercase_ascii s = map Char.uppercase_ascii s
+
+ let capitalize_ascii s =
+ let b = Bytes.of_string s in
+ Bytes.unsafe_set b 0 (Char.uppercase_ascii (Byt...
2015 Oct 07
1
Re: [PATCH 3/5] mllib: Add (Char|String).(lower|upper)case_ascii functions.
...char -> char
> +
> + val lowercase_ascii : char -> char
> + val uppercase_ascii : char -> char
> end
> (** Override the Char module from stdlib. *)
>
> @@ -58,6 +61,9 @@ module String : sig
> val unsafe_get : string -> int -> char
> val unsafe_set : string -> int -> char -> unit
> val uppercase : string -> string
> +
> + val lowercase_ascii : string -> string
> + val uppercase_ascii : string -> string
> end
> (** Override the String module from stdlib. *)
>
> diff --git a/v2v/convert_w...
2016 Dec 09
0
Re: [PATCH] generator: Share Common_utils code.
...now
(reduces the changes in this patch, and it can always be moved later
on when needed).
> -let replace_char s c1 c2 =
> - let b2 = Bytes.of_string s in
> - let r = ref false in
> - for i = 0 to Bytes.length b2 - 1 do
> - if Bytes.unsafe_get b2 i = c1 then (
> - Bytes.unsafe_set b2 i c2;
> - r := true
> - )
> - done;
> - if not !r then s else Bytes.to_string b2
Ditto.
> -let isspace c =
> - c = ' '
> - (* || c = '\f' *) || c = '\n' || c = '\r' || c = '\t' (* || c = '\v' *)
Ditto.
> -let...
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...sed_by functions =
let failwithf fs = ksprintf failwith fs
-let unique = let i = ref 0 in fun () -> incr i; !i
-
-let replace_char s c1 c2 =
- let b2 = Bytes.of_string s in
- let r = ref false in
- for i = 0 to Bytes.length b2 - 1 do
- if Bytes.unsafe_get b2 i = c1 then (
- Bytes.unsafe_set b2 i c2;
- r := true
- )
- done;
- if not !r then s else Bytes.to_string b2
-
-let isspace c =
- c = ' '
- (* || c = '\f' *) || c = '\n' || c = '\r' || c = '\t' (* || c = '\v' *)
-
-let triml ?(test = isspace) str =
- let i = ref 0 in
-...
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 Feb 18
11
[PATCH 0/8] Miscellaneous cleanups to Windows registry code.
A very miscellaneous set of cleanups to how we handle the Windows
registry in virt-v2v, firstboot, and inspection code. This should all
be straightforward non-controversial refactoring. Some highlights:
- Add a new mllib Registry module containing various utility
functions that are currently scattered all around.
- Only compute the software/system hive paths once during inspection,
and
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
2018 Dec 04
2
[PATCH FOR DISCUSSION ONLY 0/2] v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).
This patch is just for discussion. There are still a couple of issues
that I'm trying to fix.
One is that all of the test guests I have, even ones with static IPs,
have multiple interfaces, some using DHCP, so the conditions for
adding the Powershell script don't kick in. This makes testing very
awkward.
However a bigger issue is that I think the premise is wrong. In some
registries
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:
-
2018 Dec 11
2
[PATCH v2 2/2] v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).
v1 was here with much discussion:
https://www.redhat.com/archives/libguestfs/2018-December/msg00048.html
v2:
- Fix the case where there are multiple interfaces. Note this does
not preserve order correctly (see patch for comment on why that
is a hard problem).
- Preserve name servers.
This patch is still for discussion only. I'd like to see what might
be done to get this upstream
2012 Aug 16
5
[PATCH 0/4] Add customization capabilities to virt-sysprep
In the TODO file there's a discussion of perhaps writing a new
'virt-customize' tool. I think it's probably better (or at any rate,
easier) to just add this functionality into virt-sysprep. That is
what this small series of patches aims to achieve.
Note these are not very well tested at the moment.
The first patch adds a generic and useful '--firstboot' flag. The
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