mirror of
https://github.com/google/go-jsonnet.git
synced 2026-05-05 20:16:12 +02:00
c-bindings: Add jsonnet_realloc export
This adds the realloc function as an export in c-bindings.go so that it is included in the generated header and can be used by dependent libraries.
This commit is contained in:
parent
635d04f264
commit
eac7db4471
@ -663,5 +663,11 @@ func jsonnet_set_trace_out_callback(vmRef *C.struct_JsonnetVm, cb *C.JsonnetIoWr
|
||||
vm.SetTraceOut(&traceOut{cb})
|
||||
}
|
||||
|
||||
//export jsonnet_realloc
|
||||
func jsonnet_realloc(vmRef *C.struct_JsonnetVm, buf *C.char, sz C.size_t) *C.char {
|
||||
return C.jsonnet_internal_realloc(vmRef, buf, sz)
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
}
|
||||
|
||||
@ -46,3 +46,5 @@ int jsonnet_internal_execute_writer(JsonnetIoWriterCallback *cb,
|
||||
int *success);
|
||||
|
||||
void jsonnet_internal_free_string(char *str);
|
||||
|
||||
char* jsonnet_internal_realloc(struct JsonnetVm *vm, char *str, size_t sz);
|
||||
|
||||
@ -72,7 +72,7 @@ static void memory_panic(void)
|
||||
abort();
|
||||
}
|
||||
|
||||
char *jsonnet_realloc(JsonnetVm *vm, char *str, size_t sz)
|
||||
char *jsonnet_internal_realloc(JsonnetVm *vm, char *str, size_t sz)
|
||||
{
|
||||
(void)vm;
|
||||
if (str == nullptr) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user