Skip to content
Snippets Groups Projects
Commit a9afcb15 authored by Damien George's avatar Damien George
Browse files

unix/modffi.c: get_buffer is allowed to return NULL if len=0.

This is consistent with the logic in mp_get_buffer, and the code here is
an inlined version of that function.
parent a62c1069
No related branches found
No related tags found
No related merge requests found
...@@ -375,7 +375,7 @@ STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, ...@@ -375,7 +375,7 @@ STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw,
mp_obj_base_t *o = (mp_obj_base_t*)a; mp_obj_base_t *o = (mp_obj_base_t*)a;
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
int ret = o->type->buffer_p.get_buffer(o, &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ? int ret = o->type->buffer_p.get_buffer(o, &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ?
if (ret != 0 || bufinfo.buf == NULL) { if (ret != 0) {
goto error; goto error;
} }
values[i] = (ffi_arg)bufinfo.buf; values[i] = (ffi_arg)bufinfo.buf;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment