diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/file.c | 10 | ||||
-rw-r--r-- | unix/modsocket.c | 10 | ||||
-rw-r--r-- | unix/mpconfigport.h | 1 | ||||
-rw-r--r-- | unix/qstrdefsport.h | 1 |
4 files changed, 12 insertions, 10 deletions
diff --git a/unix/file.c b/unix/file.c index 780e84718d..2cc17dfd34 100644 --- a/unix/file.c +++ b/unix/file.c @@ -123,6 +123,11 @@ STATIC const mp_map_elem_t rawfile_locals_dict_table[] = { STATIC MP_DEFINE_CONST_DICT(rawfile_locals_dict, rawfile_locals_dict_table); +STATIC const mp_stream_p_t rawfile_stream_p = { + .read = fdfile_read, + .write = fdfile_write, +}; + STATIC const mp_obj_type_t rawfile_type = { { &mp_type_type }, .name = MP_QSTR_io_dot_FileIO, @@ -130,10 +135,7 @@ STATIC const mp_obj_type_t rawfile_type = { .make_new = fdfile_make_new, .getiter = mp_identity, .iternext = mp_stream_unbuffered_iter, - .stream_p = { - .read = fdfile_read, - .write = fdfile_write, - }, + .stream_p = &rawfile_stream_p, .locals_dict = (mp_obj_t)&rawfile_locals_dict, }; diff --git a/unix/modsocket.c b/unix/modsocket.c index 6bdbc889d6..62f10300f8 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -240,6 +240,11 @@ STATIC const mp_map_elem_t microsocket_locals_dict_table[] = { STATIC MP_DEFINE_CONST_DICT(microsocket_locals_dict, microsocket_locals_dict_table); +STATIC const mp_stream_p_t microsocket_stream_p = { + .read = socket_read, + .write = socket_write, +}; + STATIC const mp_obj_type_t microsocket_type = { { &mp_type_type }, .name = MP_QSTR_socket, @@ -247,10 +252,7 @@ STATIC const mp_obj_type_t microsocket_type = { .make_new = socket_make_new, .getiter = NULL, .iternext = NULL, - .stream_p = { - .read = socket_read, - .write = socket_write, - }, + .stream_p = µsocket_stream_p, .locals_dict = (mp_obj_t)µsocket_locals_dict, }; diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 3798f88b58..e2f2a69e11 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -31,7 +31,6 @@ typedef unsigned int machine_uint_t; // must be pointer size typedef void *machine_ptr_t; // must be of pointer size typedef const void *machine_const_ptr_t; // must be of pointer size -struct _mp_obj_fun_native_t; extern const struct _mp_obj_fun_native_t mp_builtin_open_obj; #define MICROPY_EXTRA_BUILTINS \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, diff --git a/unix/qstrdefsport.h b/unix/qstrdefsport.h index bfef9eb0da..fd259f327c 100644 --- a/unix/qstrdefsport.h +++ b/unix/qstrdefsport.h @@ -3,7 +3,6 @@ Q(Test) Q(argv) -Q(open) Q(stdin) Q(stdout) Q(stderr) |