diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-05 15:54:51 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-05 15:54:51 -0800 |
commit | 73595feb75d36501a5b1fdea979357b2b6863fc2 (patch) | |
tree | 587493638de524c046b54852bab63459478feb77 /py/objlist.c | |
parent | 6b0b4a0cad348813f54d1395cee5fe77ea38dad0 (diff) | |
parent | 860ffb0a4365bba62cbd692392375df9fd4a72e7 (diff) | |
download | micropython-73595feb75d36501a5b1fdea979357b2b6863fc2.tar.gz micropython-73595feb75d36501a5b1fdea979357b2b6863fc2.zip |
Merge pull request #89 from pfalcon/c99-tagged-structs
Convert many object types structs to use C99 tagged initializer syntax.
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/py/objlist.c b/py/objlist.c index 6c0de405fe..a656a4aeb6 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -208,14 +208,12 @@ static MP_DEFINE_CONST_FUN_OBJ_2(list_sort_obj, list_sort); const mp_obj_type_t list_type = { { &mp_const_type }, "list", - list_print, // print - list_make_new, // make_new - NULL, // call_n - NULL, // unary_op - list_binary_op, // binary_op - list_getiter, // getiter - NULL, // iternext - { // method list + .print = list_print, + .make_new = list_make_new, + .unary_op = NULL, + .binary_op = list_binary_op, + .getiter = list_getiter, + .methods = { { "append", &list_append_obj }, { "clear", &list_clear_obj }, { "copy", &list_copy_obj }, @@ -287,14 +285,8 @@ mp_obj_t list_it_iternext(mp_obj_t self_in) { static const mp_obj_type_t list_it_type = { { &mp_const_type }, "list_iterator", - NULL, // print - NULL, // make_new - NULL, // call_n - NULL, // unary_op - NULL, // binary_op - NULL, // getiter - list_it_iternext, // iternext - { { NULL, NULL }, }, // method list + .iternext = list_it_iternext, + .methods = { { NULL, NULL }, }, }; mp_obj_t mp_obj_new_list_iterator(mp_obj_list_t *list, int cur) { |