diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-26 20:15:40 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-26 20:15:40 +0000 |
commit | c12b2213c16ba8839981c362c4d5f133a84b374b (patch) | |
tree | 59e3de4cce2ab28a9d4f73ba70477be98fb3c353 /stmhal/help.c | |
parent | 69b3ba0df38e276b55f8f76e7f5276723e6d3abe (diff) | |
download | micropython-c12b2213c16ba8839981c362c4d5f133a84b374b.tar.gz micropython-c12b2213c16ba8839981c362c4d5f133a84b374b.zip |
Change mp_method_t.name from const char * to qstr.
Addresses issue #377.
Diffstat (limited to 'stmhal/help.c')
-rw-r--r-- | stmhal/help.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/stmhal/help.c b/stmhal/help.c index 9efe374524..a1c81c824f 100644 --- a/stmhal/help.c +++ b/stmhal/help.c @@ -38,14 +38,10 @@ STATIC const char *help_text = " CTRL-D -- on a blank line, do a soft reset of the board\n" ; -STATIC void pyb_help_print_info_about_object(mp_obj_t name_o, const char *name_str, mp_obj_t value) { - if (name_o != MP_OBJ_NULL) { - printf(" "); - mp_obj_print(name_o, PRINT_STR); - printf(" -- "); - } else { - printf(" %s -- ", name_str); - } +STATIC void pyb_help_print_info_about_object(mp_obj_t name_o, mp_obj_t value) { + printf(" "); + mp_obj_print(name_o, PRINT_STR); + printf(" -- "); mp_obj_print(value, PRINT_STR); printf("\n"); } @@ -72,14 +68,14 @@ STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) { if (map != NULL) { for (uint i = 0; i < map->alloc; i++) { if (map->table[i].key != MP_OBJ_NULL) { - pyb_help_print_info_about_object(map->table[i].key, NULL, map->table[i].value); + pyb_help_print_info_about_object(map->table[i].key, map->table[i].value); } } } if (type->methods != NULL) { - for (const mp_method_t *meth = type->methods; meth->name != NULL; meth++) { - pyb_help_print_info_about_object(MP_OBJ_NULL, meth->name, (mp_obj_t)meth->fun); + for (const mp_method_t *meth = type->methods; meth->name != MP_QSTR_NULL; meth++) { + pyb_help_print_info_about_object(MP_OBJ_NEW_QSTR(meth->name), (mp_obj_t)meth->fun); } } } |