|
|
498672 |
From 3860ab78d9fe5c34785aabc2227ebc8687b1171b Mon Sep 17 00:00:00 2001
|
|
|
498672 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
498672 |
Date: Thu, 5 Sep 2019 09:00:14 +0100
|
|
|
498672 |
Subject: [PATCH] ocaml: Change calls to caml_named_value() to cope with const
|
|
|
498672 |
value* return.
|
|
|
498672 |
|
|
|
498672 |
In OCaml >= 4.09 the return value pointer of caml_named_value is
|
|
|
498672 |
declared const.
|
|
|
498672 |
|
|
|
498672 |
Based on Pino Toscano's original patch to ocaml-augeas.
|
|
|
498672 |
|
|
|
498672 |
(cherry picked from commit 9788fa50601ad4f1eab56d0b763591268026e536)
|
|
|
498672 |
---
|
|
|
498672 |
common/mlpcre/pcre-c.c | 3 +--
|
|
|
498672 |
common/mltools/uri-c.c | 6 ++----
|
|
|
498672 |
common/mlvisit/visit-c.c | 4 +---
|
|
|
498672 |
3 files changed, 4 insertions(+), 9 deletions(-)
|
|
|
498672 |
|
|
|
498672 |
diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c
|
|
|
498672 |
index 0762a8341..07f99b8d6 100644
|
|
|
498672 |
--- a/common/mlpcre/pcre-c.c
|
|
|
498672 |
+++ b/common/mlpcre/pcre-c.c
|
|
|
498672 |
@@ -73,12 +73,11 @@ init (void)
|
|
|
498672 |
static void
|
|
|
498672 |
raise_pcre_error (const char *msg, int errcode)
|
|
|
498672 |
{
|
|
|
498672 |
- value *exn = caml_named_value ("PCRE.Error");
|
|
|
498672 |
value args[2];
|
|
|
498672 |
|
|
|
498672 |
args[0] = caml_copy_string (msg);
|
|
|
498672 |
args[1] = Val_int (errcode);
|
|
|
498672 |
- caml_raise_with_args (*exn, 2, args);
|
|
|
498672 |
+ caml_raise_with_args (*caml_named_value ("PCRE.Error"), 2, args);
|
|
|
498672 |
}
|
|
|
498672 |
|
|
|
498672 |
/* Wrap and unwrap pcre regular expression handles, with a finalizer. */
|
|
|
498672 |
diff --git a/common/mltools/uri-c.c b/common/mltools/uri-c.c
|
|
|
498672 |
index 2a8837cd9..e03647c7b 100644
|
|
|
498672 |
--- a/common/mltools/uri-c.c
|
|
|
498672 |
+++ b/common/mltools/uri-c.c
|
|
|
498672 |
@@ -46,10 +46,8 @@ guestfs_int_mllib_parse_uri (value argv /* arg value, not an array! */)
|
|
|
498672 |
int r;
|
|
|
498672 |
|
|
|
498672 |
r = parse_uri (String_val (argv), &uri);
|
|
|
498672 |
- if (r == -1) {
|
|
|
498672 |
- value *exn = caml_named_value ("URI.Parse_failed");
|
|
|
498672 |
- caml_raise (*exn);
|
|
|
498672 |
- }
|
|
|
498672 |
+ if (r == -1)
|
|
|
498672 |
+ caml_raise (*caml_named_value ("URI.Parse_failed"));
|
|
|
498672 |
|
|
|
498672 |
/* Convert the struct into an OCaml tuple. */
|
|
|
498672 |
rv = caml_alloc_tuple (5);
|
|
|
498672 |
diff --git a/common/mlvisit/visit-c.c b/common/mlvisit/visit-c.c
|
|
|
498672 |
index 7137c4998..201f6d762 100644
|
|
|
498672 |
--- a/common/mlvisit/visit-c.c
|
|
|
498672 |
+++ b/common/mlvisit/visit-c.c
|
|
|
498672 |
@@ -53,7 +53,6 @@ value
|
|
|
498672 |
guestfs_int_mllib_visit (value gv, value dirv, value fv)
|
|
|
498672 |
{
|
|
|
498672 |
CAMLparam3 (gv, dirv, fv);
|
|
|
498672 |
- value *visit_failure_exn;
|
|
|
498672 |
guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gv);
|
|
|
498672 |
struct visitor_function_wrapper_args args;
|
|
|
498672 |
/* The dir string could move around when we call the
|
|
|
498672 |
@@ -84,8 +83,7 @@ guestfs_int_mllib_visit (value gv, value dirv, value fv)
|
|
|
498672 |
* already printed the error to stderr (XXX - fix), so we raise a
|
|
|
498672 |
* generic exception.
|
|
|
498672 |
*/
|
|
|
498672 |
- visit_failure_exn = caml_named_value ("Visit.Failure");
|
|
|
498672 |
- caml_raise (*visit_failure_exn);
|
|
|
498672 |
+ caml_raise (*caml_named_value ("Visit.Failure"));
|
|
|
498672 |
}
|
|
|
498672 |
free (dir);
|
|
|
498672 |
|
|
|
498672 |
--
|
|
|
498672 |
2.18.4
|
|
|
498672 |
|