Skip to content

Commit 738bdeb

Browse files
committed
unix: Update to use new buffer protocol interface with typecode.
1 parent 57a4b4f commit 738bdeb

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

unix/modffi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ mp_obj_t ffifunc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *
268268
values[i] = (ffi_arg)s;
269269
} else if (((mp_obj_base_t*)a)->type->buffer_p.get_buffer != NULL) {
270270
mp_obj_base_t *o = (mp_obj_base_t*)a;
271-
buffer_info_t bufinfo;
272-
o->type->buffer_p.get_buffer(o, &bufinfo, BUFFER_READ); // TODO: BUFFER_READ?
273-
if (bufinfo.buf == NULL) {
271+
mp_buffer_info_t bufinfo;
272+
int ret = o->type->buffer_p.get_buffer(o, &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ?
273+
if (ret != 0 || bufinfo.buf == NULL) {
274274
goto error;
275275
}
276276
values[i] = (ffi_arg)bufinfo.buf;

unix/modsocket.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
8080

8181
STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
8282
mp_obj_socket_t *self = self_in;
83-
buffer_info_t bufinfo;
83+
mp_buffer_info_t bufinfo;
8484
mp_get_buffer_raise(addr_in, &bufinfo);
8585
int r = connect(self->fd, (const struct sockaddr *)bufinfo.buf, bufinfo.len);
8686
RAISE_ERRNO(r, errno);
@@ -90,7 +90,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
9090

9191
STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
9292
mp_obj_socket_t *self = self_in;
93-
buffer_info_t bufinfo;
93+
mp_buffer_info_t bufinfo;
9494
mp_get_buffer_raise(addr_in, &bufinfo);
9595
int r = bind(self->fd, (const struct sockaddr *)bufinfo.buf, bufinfo.len);
9696
RAISE_ERRNO(r, errno);
@@ -168,7 +168,7 @@ STATIC mp_obj_t socket_setsockopt(uint n_args, const mp_obj_t *args) {
168168
optval = &val;
169169
optlen = sizeof(val);
170170
} else {
171-
buffer_info_t bufinfo;
171+
mp_buffer_info_t bufinfo;
172172
mp_get_buffer_raise(args[3], &bufinfo);
173173
optval = bufinfo.buf;
174174
optlen = bufinfo.len;

0 commit comments

Comments
 (0)