[OCaml] Code simplification using string allocation functions
authorJosh Berdine <josh@berdine.net>
Sat, 27 Mar 2021 23:00:47 +0000 (23:00 +0000)
committerJosh Berdine <josh@berdine.net>
Mon, 5 Apr 2021 09:55:07 +0000 (10:55 +0100)
commit2c82ea1849dc77eedeedb59a73c870717229ed37
treef8f5c881faf394c98e219dd5347fb730b9a85dfd
parente5b7fedc573c8f7977c8a4800144df6d341d8887
[OCaml] Code simplification using string allocation functions

Using the `cstr_to_string` function that allocates and initializes an
OCaml `string` value enables simplifications in several cases. This
change also has the effect of avoiding calling `memcpy` on NULL
pointers even if only 0 bytes are to be copied.

Differential Revision: https://reviews.llvm.org/D99474
llvm/bindings/ocaml/llvm/llvm_ocaml.c