mirror of
https://github.com/janet-lang/janet
synced 2025-01-11 16:10:27 +00:00
Cast NULL pointer to nil in return in ffi.
This commit is contained in:
parent
1a1dd39367
commit
20511cf608
@ -491,8 +491,10 @@ static Janet janet_ffi_read_one(const uint8_t *from, JanetFFIType type, int recu
|
||||
return janet_wrap_number(((double *)(from))[0]);
|
||||
case JANET_FFI_TYPE_FLOAT:
|
||||
return janet_wrap_number(((float *)(from))[0]);
|
||||
case JANET_FFI_TYPE_PTR:
|
||||
return janet_wrap_pointer(((void **)(from))[0]);
|
||||
case JANET_FFI_TYPE_PTR: {
|
||||
void *ptr = ((void **)(from))[0];
|
||||
return (NULL == ptr) ? janet_wrap_nil() : janet_wrap_pointer(ptr);
|
||||
}
|
||||
case JANET_FFI_TYPE_BOOL:
|
||||
return janet_wrap_boolean(((bool *)(from))[0]);
|
||||
case JANET_FFI_TYPE_INT8:
|
||||
|
Loading…
Reference in New Issue
Block a user