From 0028d9a106b706ad4e8820a1a7ae5daa023f604f Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 13 Sep 2017 18:24:58 +0200 Subject: [PATCH] Create a separate raise_init_error function Used only on init, when there is no augeas pointer available. --- augeas-c.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/augeas-c.c b/augeas-c.c index c06bf92..6a11e99 100644 --- a/augeas-c.c +++ b/augeas-c.c @@ -38,6 +38,12 @@ raise_error (const char *msg) caml_raise_with_string (*caml_named_value ("Augeas.Error"), msg); } +static void +raise_init_error (const char *msg) +{ + caml_raise_with_string (*caml_named_value ("Augeas.Error"), msg); +} + /* Map OCaml flags to C flags. */ static int flag_map[] = { /* AugSaveBackup */ AUG_SAVE_BACKUP, @@ -111,7 +117,7 @@ ocaml_augeas_create (value rootv, value loadpathv, value flagsv) t = aug_init (root, loadpath, flags); if (t == NULL) - raise_error ("Augeas.create"); + raise_init_error ("Augeas.create"); CAMLreturn (Val_augeas_t (t)); } -- 1.8.3.1