From f7be9db6220cb39f0eaa12d2af3abedf0d86c303 Mon Sep 17 00:00:00 2001 From: Vaivaswatha Nagaraj Date: Wed, 17 Mar 2021 11:25:43 +0530 Subject: [PATCH] [OCaml] Fix buildbot failure in OCaml tests The commit 506df1bbfd16233134a6ddea96ed2d49077840fd introduced a call to `caml_alloc_initialized_string` which seems to be unavailable on older OCaml versions. So I'm now switching to using `caml_alloc_string` and using a `memcpy` after that, as is done in the rest of the file. Buildbot failure: https://lab.llvm.org/buildbot/#/builders/16/builds/7919 --- llvm/bindings/ocaml/llvm/llvm_ocaml.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c index 8994f52..65e8bfc 100644 --- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c +++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c @@ -48,7 +48,8 @@ CAMLprim value cstr_to_string(const unsigned char *Str, unsigned Len) { CAMLparam0(); CAMLlocal1(String); if (Str) { - String = caml_alloc_initialized_string(Len, Str); + String = caml_alloc_string(Len); + memcpy(String_val(Str), Str, Len); } else { String = caml_alloc_string(0); } -- 2.7.4