X-Git-Url: http://git.annexia.org/?p=ocaml-augeas.git;a=blobdiff_plain;f=augeas-c.c;h=7ca72442056323058ed0d2dc59e31f22dd107e42;hp=6a11e99013bb653677da918d9875eb2ba38e7035;hb=8d4400eec2d49b540e79f787e1b4b7f90bfa5591;hpb=0028d9a106b706ad4e8820a1a7ae5daa023f604f diff --git a/augeas-c.c b/augeas-c.c index 6a11e99..7ca7244 100644 --- a/augeas-c.c +++ b/augeas-c.c @@ -33,7 +33,7 @@ typedef augeas *augeas_t; /* Raise an Augeas.Error exception. */ static void -raise_error (const char *msg) +raise_error (augeas_t t, const char *msg) { caml_raise_with_string (*caml_named_value ("Augeas.Error"), msg); } @@ -156,7 +156,7 @@ ocaml_augeas_get (value tv, value pathv) } else if (r == 0) /* Return None */ optv = Val_int (0); else if (r == -1) /* Error or multiple matches */ - raise_error ("Augeas.get"); + raise_error (t, "Augeas.get"); else failwith ("Augeas.get: bad return value"); @@ -179,7 +179,7 @@ ocaml_augeas_exists (value tv, value pathv) else if (r == 0) /* Return false */ v = Val_int (0); else if (r == -1) /* Error or multiple matches */ - raise_error ("Augeas.exists"); + raise_error (t, "Augeas.exists"); else failwith ("Augeas.exists: bad return value"); @@ -199,7 +199,7 @@ ocaml_augeas_insert (value tv, value beforev, value pathv, value labelv) before = beforev == Val_int (0) ? 0 : Int_val (Field (beforev, 0)); if (aug_insert (t, path, label, before) == -1) - raise_error ("Augeas.insert"); + raise_error (t, "Augeas.insert"); CAMLreturn (Val_unit); } @@ -215,7 +215,7 @@ ocaml_augeas_rm (value tv, value pathv) r = aug_rm (t, path); if (r == -1) - raise_error ("Augeas.rm"); + raise_error (t, "Augeas.rm"); CAMLreturn (Val_int (r)); } @@ -233,7 +233,7 @@ ocaml_augeas_match (value tv, value pathv) r = aug_match (t, path, &matches); if (r == -1) - raise_error ("Augeas.matches"); + raise_error (t, "Augeas.matches"); /* Copy the paths to a list. */ rv = Val_int (0); @@ -262,7 +262,7 @@ ocaml_augeas_count_matches (value tv, value pathv) r = aug_match (t, path, NULL); if (r == -1) - raise_error ("Augeas.count_matches"); + raise_error (t, "Augeas.count_matches"); CAMLreturn (Val_int (r)); } @@ -275,7 +275,7 @@ ocaml_augeas_save (value tv) augeas_t t = Augeas_t_val (tv); if (aug_save (t) == -1) - raise_error ("Augeas.save"); + raise_error (t, "Augeas.save"); CAMLreturn (Val_unit); } @@ -288,7 +288,7 @@ ocaml_augeas_load (value tv) augeas_t t = Augeas_t_val (tv); if (aug_load (t) == -1) - raise_error ("Augeas.load"); + raise_error (t, "Augeas.load"); CAMLreturn (Val_unit); }