summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-07 23:06:46 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-07 23:06:46 +0000
commit9c83ec0edac2394431a5d1aecba1d666ffdea0a3 (patch)
treeccf18860da373cf13194788b793a962335d69fef /py/objstr.c
parent27d4ca7693c276d09a911c00c3442729c516dc23 (diff)
downloadmicropython-9c83ec0edac2394431a5d1aecba1d666ffdea0a3.tar.gz
micropython-9c83ec0edac2394431a5d1aecba1d666ffdea0a3.zip
Merge remote-tracking branch 'upstream/master' into dict_feats
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/py/objstr.c b/py/objstr.c
index db3e0beca0..cc9f7f85b4 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -184,17 +184,19 @@ mp_obj_t str_format(int n_args, const mp_obj_t *args) {
static MP_DEFINE_CONST_FUN_OBJ_2(str_join_obj, str_join);
static MP_DEFINE_CONST_FUN_OBJ_VAR(str_format_obj, 1, str_format);
+static const mp_method_t str_type_methods[] = {
+ { "join", &str_join_obj },
+ { "format", &str_format_obj },
+ { NULL, NULL }, // end-of-list sentinel
+};
+
const mp_obj_type_t str_type = {
{ &mp_const_type },
"str",
.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
- },
+ .methods = str_type_methods,
};
mp_obj_t mp_obj_new_str(qstr qstr) {
@@ -235,7 +237,6 @@ static const mp_obj_type_t str_it_type = {
{ &mp_const_type },
"str_iterator",
.iternext = str_it_iternext,
- .methods = { { NULL, NULL }, },
};
mp_obj_t mp_obj_new_str_iterator(mp_obj_str_t *str, int cur) {