diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-04-12 00:17:16 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-04-12 00:17:57 +0300 |
commit | 8b7faa31e1a98fd582db7021152fa25da69635e0 (patch) | |
tree | 562ef52aa660acee5c684350c43196f7bbca83e8 /py/objstr.c | |
parent | 6eb753008334cd93978a756df0b3630701fdaca6 (diff) | |
download | micropython-8b7faa31e1a98fd582db7021152fa25da69635e0.tar.gz micropython-8b7faa31e1a98fd582db7021152fa25da69635e0.zip |
objstr: split(None): Fix whitespace properly.
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c index 854878ca93..e35fc2976e 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -454,7 +454,6 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) { return mp_obj_new_str_from_vstr(self_type, &vstr); } -#define is_ws(c) ((c) == ' ' || (c) == '\t') enum {SPLIT = 0, KEEP = 1, SPLITLINES = 2}; STATIC inline mp_obj_t str_split_internal(mp_uint_t n_args, const mp_obj_t *args, int type) { @@ -476,15 +475,15 @@ STATIC inline mp_obj_t str_split_internal(mp_uint_t n_args, const mp_obj_t *args // sep not given, so separate on whitespace // Initial whitespace is not counted as split, so we pre-do it - while (s < top && is_ws(*s)) s++; + while (s < top && unichar_isspace(*s)) s++; while (s < top && splits != 0) { const byte *start = s; - while (s < top && !is_ws(*s)) s++; + while (s < top && !unichar_isspace(*s)) s++; mp_obj_list_append(res, mp_obj_new_str_of_type(self_type, start, s - start)); if (s >= top) { break; } - while (s < top && is_ws(*s)) s++; + while (s < top && unichar_isspace(*s)) s++; if (splits > 0) { splits--; } |