Browse Source

all: Standardise mp_obj_type_t initialisation.

Remove setting unused slots.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/9351/head
Jim Mussared 3 years ago
committed by Damien George
parent
commit
42587c7870
  1. 1
      extmod/vfs_fat.c
  2. 8
      ports/nrf/boards/microbit/modules/iters.c
  3. 9
      ports/nrf/boards/microbit/modules/microbitdisplay.c
  4. 42
      ports/nrf/boards/microbit/modules/microbitimage.c

1
extmod/vfs_fat.c

@ -437,7 +437,6 @@ const mp_obj_type_t mp_fat_vfs_type = {
.make_new = fat_vfs_make_new,
.protocol = &fat_vfs_proto,
.locals_dict = (mp_obj_dict_t *)&fat_vfs_locals_dict,
};
#endif // MICROPY_VFS_FAT

8
ports/nrf/boards/microbit/modules/iters.c

@ -46,16 +46,8 @@ static mp_obj_t microbit_repeat_iter_next(mp_obj_t iter_in) {
const mp_obj_type_t microbit_repeat_iterator_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = NULL,
.binary_op = NULL,
.attr = NULL,
.subscr = NULL,
.getiter = mp_identity_getiter,
.iternext = microbit_repeat_iter_next,
MP_OBJ_NULL
};
mp_obj_t microbit_repeat_iterator(mp_obj_t iterable) {

9
ports/nrf/boards/microbit/modules/microbitdisplay.c

@ -545,15 +545,6 @@ STATIC MP_DEFINE_CONST_DICT(microbit_display_locals_dict, microbit_display_local
const mp_obj_type_t microbit_display_type = {
{ &mp_type_type },
.name = MP_QSTR_MicroBitDisplay,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = NULL,
.binary_op = NULL,
.attr = NULL,
.subscr = NULL,
.getiter = NULL,
.iternext = NULL,
.locals_dict = (mp_obj_dict_t*)&microbit_display_locals_dict,
};

42
ports/nrf/boards/microbit/modules/microbitimage.c

@ -683,13 +683,7 @@ const mp_obj_type_t microbit_image_type = {
.name = MP_QSTR_MicroBitImage,
.print = microbit_image_print,
.make_new = microbit_image_make_new,
.call = NULL,
.unary_op = NULL,
.binary_op = image_binary_op,
.attr = NULL,
.subscr = NULL,
.getiter = NULL,
.iternext = NULL,
.locals_dict = (mp_obj_dict_t*)&microbit_image_locals_dict,
};
@ -829,33 +823,14 @@ STATIC mp_obj_t microbit_scrolling_string_iter_next(mp_obj_t o_in) {
const mp_obj_type_t microbit_scrolling_string_type = {
{ &mp_type_type },
.name = MP_QSTR_ScrollingString,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = NULL,
.binary_op = NULL,
.attr = NULL,
.subscr = NULL,
.getiter = get_microbit_scrolling_string_iter,
.iternext = NULL,
.buffer_p = {NULL},
.locals_dict = NULL,
};
const mp_obj_type_t microbit_scrolling_string_iterator_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = NULL,
.binary_op = NULL,
.attr = NULL,
.subscr = NULL,
.getiter = mp_identity_getiter,
.iternext = microbit_scrolling_string_iter_next,
.buffer_p = {NULL},
.locals_dict = NULL,
};
/** Facade types to present a string as a sequence of images.
@ -897,17 +872,9 @@ static mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t
const mp_obj_type_t string_image_facade_type = {
{ &mp_type_type },
.name = MP_QSTR_Facade,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = facade_unary_op,
.binary_op = NULL,
.attr = NULL,
.subscr = string_image_facade_subscr,
.getiter = microbit_facade_iterator,
.iternext = NULL,
.buffer_p = {NULL},
NULL
};
@ -940,17 +907,8 @@ static mp_obj_t microbit_facade_iter_next(mp_obj_t iter_in) {
const mp_obj_type_t microbit_facade_iterator_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = NULL,
.binary_op = NULL,
.attr = NULL,
.subscr = NULL,
.getiter = mp_identity_getiter,
.iternext = microbit_facade_iter_next,
.buffer_p = {NULL},
NULL
};
mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t *iter_buf) {

Loading…
Cancel
Save