@@ -59,27 +59,33 @@ static void completion_bridge(const char *buf, linenoiseCompletions *lc)
59
59
caml_release_runtime_system ();
60
60
}
61
61
62
- static char * hints_bridge (const char * buf , int * color , int * bold )
62
+ static char * hints_bridge_inner (const char * buf , int * color , int * bold )
63
63
{
64
- caml_acquire_runtime_system ();
65
64
CAMLparam0 ();
66
65
CAMLlocal2 (str_copy , cb_result );
67
66
68
67
str_copy = caml_copy_string (buf );
69
68
70
69
cb_result = caml_callback (* caml_named_value ("lnoise_hints_cb" ), str_copy );
71
70
if (cb_result == Val_none ) {
72
- caml_release_runtime_system ();
73
71
CAMLreturnT (char * ,NULL);
74
72
} else {
75
73
char * msg = caml_stat_strdup (String_val (Field (Field (cb_result , 0 ), 0 )));
76
74
* color = Int_val (Field (Field (cb_result , 0 ), 1 )) + 31 ;
77
75
* bold = Bool_val (Field (Field (cb_result , 0 ), 2 ));
78
- caml_release_runtime_system ();
79
76
CAMLreturnT (char * ,msg );
80
77
}
81
78
}
82
79
80
+ static char * hints_bridge (const char * buf , int * color , int * bold )
81
+ {
82
+ caml_acquire_runtime_system ();
83
+ char * res = hints_bridge_inner (buf , color , bold );
84
+ caml_release_runtime_system ();
85
+ return res ;
86
+ }
87
+
88
+
83
89
static void free_hints_bridge (void * data ) {
84
90
caml_acquire_runtime_system ();
85
91
caml_stat_free (data );
0 commit comments