From 3b5376328da58fe2ead45350c5ce6cfcb54ad128 Mon Sep 17 00:00:00 2001 From: Edgar Aroutiounian Date: Wed, 26 Oct 2016 10:59:09 -0700 Subject: [PATCH] Fix mistake in hints_bridge, thanks yallop!! --- src/linenoise_stubs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/linenoise_stubs.c b/src/linenoise_stubs.c index d28de75..0513065 100644 --- a/src/linenoise_stubs.c +++ b/src/linenoise_stubs.c @@ -35,15 +35,16 @@ static void completion_bridge(const char *buf, linenoiseCompletions *lc) static char *hints_bridge(const char *buf, int *color, int *bold) { + CAMLparam0(); CAMLlocal1(cb_result); cb_result = caml_callback(hints_cb, caml_copy_string(buf)); if (cb_result == Val_none) { - return NULL; + CAMLreturnT(char *,NULL); } else { - const char *msg = caml_strdup(String_val(Field(Field(cb_result, 0), 0))); + char *msg = caml_strdup(String_val(Field(Field(cb_result, 0), 0))); *color = Int_val(Field(Field(cb_result, 0), 1)) + 31; *bold = Bool_val(Field(Field(cb_result, 0), 2)); - return (char *)msg; + CAMLreturnT(char *,msg); } }