mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
ocaml: Change calls to caml_named_value() to cope with const value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is declared const. Based on Pino Toscano's original patch to ocaml-augeas.
This commit is contained in:
@@ -73,12 +73,11 @@ init (void)
|
||||
static void
|
||||
raise_pcre_error (const char *msg, int errcode)
|
||||
{
|
||||
value *exn = caml_named_value ("PCRE.Error");
|
||||
value args[2];
|
||||
|
||||
args[0] = caml_copy_string (msg);
|
||||
args[1] = Val_int (errcode);
|
||||
caml_raise_with_args (*exn, 2, args);
|
||||
caml_raise_with_args (*caml_named_value ("PCRE.Error"), 2, args);
|
||||
}
|
||||
|
||||
/* Wrap and unwrap pcre regular expression handles, with a finalizer. */
|
||||
|
||||
@@ -46,10 +46,8 @@ guestfs_int_mllib_parse_uri (value argv /* arg value, not an array! */)
|
||||
int r;
|
||||
|
||||
r = parse_uri (String_val (argv), &uri);
|
||||
if (r == -1) {
|
||||
value *exn = caml_named_value ("URI.Parse_failed");
|
||||
caml_raise (*exn);
|
||||
}
|
||||
if (r == -1)
|
||||
caml_raise (*caml_named_value ("URI.Parse_failed"));
|
||||
|
||||
/* Convert the struct into an OCaml tuple. */
|
||||
rv = caml_alloc_tuple (5);
|
||||
|
||||
@@ -53,7 +53,6 @@ value
|
||||
guestfs_int_mllib_visit (value gv, value dirv, value fv)
|
||||
{
|
||||
CAMLparam3 (gv, dirv, fv);
|
||||
value *visit_failure_exn;
|
||||
guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gv);
|
||||
struct visitor_function_wrapper_args args;
|
||||
/* The dir string could move around when we call the
|
||||
@@ -84,8 +83,7 @@ guestfs_int_mllib_visit (value gv, value dirv, value fv)
|
||||
* already printed the error to stderr (XXX - fix), so we raise a
|
||||
* generic exception.
|
||||
*/
|
||||
visit_failure_exn = caml_named_value ("Visit.Failure");
|
||||
caml_raise (*visit_failure_exn);
|
||||
caml_raise (*caml_named_value ("Visit.Failure"));
|
||||
}
|
||||
free (dir);
|
||||
|
||||
|
||||
@@ -746,7 +746,7 @@ let generate_daemon_caml_stubs () =
|
||||
let nr_args = List.length args_do_function in
|
||||
|
||||
pr "{\n";
|
||||
pr " static value *cb = NULL;\n";
|
||||
pr " static const value *cb = NULL;\n";
|
||||
pr " CAMLparam0 ();\n";
|
||||
pr " CAMLlocal2 (v, retv);\n";
|
||||
pr " CAMLlocalN (args, %d);\n"
|
||||
|
||||
Reference in New Issue
Block a user