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/objstr.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/objstr.c')
-rw-r--r-- | py/objstr.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/py/objstr.c b/py/objstr.c index a1d139e83a..db3e0beca0 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -187,14 +187,10 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR(str_format_obj, 1, str_format); const mp_obj_type_t str_type = { { &mp_const_type }, "str", - str_print, // print - NULL, // make_new - NULL, // call_n - NULL, // unary_op - str_binary_op, // binary_op - str_getiter, // getiter - NULL, // iternext - { // method list + .print = str_print, + .binary_op = str_binary_op, + .getiter = str_getiter, + .methods = { { "join", &str_join_obj }, { "format", &str_format_obj }, { NULL, NULL }, // end-of-list sentinel @@ -238,14 +234,8 @@ mp_obj_t str_it_iternext(mp_obj_t self_in) { static const mp_obj_type_t str_it_type = { { &mp_const_type }, "str_iterator", - NULL, // print - NULL, // make_new - NULL, // call_n - NULL, // unary_op - NULL, // binary_op - NULL, // getiter - str_it_iternext, // iternext - { { NULL, NULL }, }, // method str + .iternext = str_it_iternext, + .methods = { { NULL, NULL }, }, }; mp_obj_t mp_obj_new_str_iterator(mp_obj_str_t *str, int cur) { |