]> xenbits.xensource.com Git - xen.git/commit
ocaml/libs/xb: Use bytes in place of strings for mutable buffers
authorMarcello Seri <marcello.seri@citrix.com>
Thu, 31 May 2018 13:05:36 +0000 (14:05 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 4 Jun 2018 10:17:22 +0000 (11:17 +0100)
commitec7d54dd1a87801ed328f4fa38ffdeaef1265958
tree0bdc04c8ab4902d9bd6394ad522c6b86b87eea09
parent237c31b5a1d5aa88cdb59b8c31b1b62eb13e82d1
ocaml/libs/xb: Use bytes in place of strings for mutable buffers

Since Ocaml 4.06.0, that made safe-string on by default, the compiler is
allowed to perform optimisations on immutable strings.  They should no
longer be used as mutable buffers, and bytes should be used instead.

The C stubs for Xs_ring have been updated to use bytes, and the interface
rationalised mimicking the new Unix module in the standard library (the
implementation of Unix.write_substring uses unsafe_of_string in the exact same
way, and both the write implementations are using the bytes as an immutable
payload for the write).

Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
tools/ocaml/libs/xb/xb.ml
tools/ocaml/libs/xb/xb.mli
tools/ocaml/libs/xb/xs_ring.ml