@@ -104,9 +104,15 @@ rubyjsonnet_jump_tag(const char *exc_mesg)
104104 return 0 ;
105105}
106106
107+ #ifdef HAVE_JSONNET_IMPORT_CALLBACK_0_19
108+ static int
109+ import_callback_entrypoint (void * ctx , const char * base , const char * rel , char * * found_here ,
110+ char * * buf , size_t * buflen )
111+ #else
107112static char *
108113import_callback_entrypoint (void * ctx , const char * base , const char * rel , char * * found_here ,
109114 int * success )
115+ #endif
110116{
111117 struct jsonnet_vm_wrap * const vm = (struct jsonnet_vm_wrap * )ctx ;
112118 int state ;
@@ -123,14 +129,26 @@ import_callback_entrypoint(void *ctx, const char *base, const char *rel, char **
123129
124130 if (state ) {
125131 VALUE msg = rescue_callback (state , "cannot import %s from %s" , rel , base );
132+ #ifdef HAVE_JSONNET_IMPORT_CALLBACK_0_19
133+ * buf = rubyjsonnet_str_to_cstr (vm -> vm , msg );
134+ * buflen = RSTRING_LEN (msg );
135+ return 1 ;
136+ #else
126137 * success = 0 ;
127138 return rubyjsonnet_str_to_cstr (vm -> vm , msg );
139+ #endif
128140 }
129141
130142 result = rb_Array (result );
131- * success = 1 ;
132143 * found_here = rubyjsonnet_str_to_cstr (vm -> vm , rb_ary_entry (result , 1 ));
144+ #ifdef HAVE_JSONNET_IMPORT_CALLBACK_0_19
145+ * buf = rubyjsonnet_str_to_cstr (vm -> vm , rb_ary_entry (result , 0 ));
146+ * buflen = RSTRING_LEN (rb_ary_entry (result , 0 ));
147+ return 0 ;
148+ #else
149+ * success = 1 ;
133150 return rubyjsonnet_str_to_cstr (vm -> vm , rb_ary_entry (result , 0 ));
151+ #endif
134152}
135153
136154/*
0 commit comments