diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-29 13:57:23 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-29 13:57:23 +0000 |
commit | 827b0f747b2aa4870ef8de90cb0c3a4151e5ce71 (patch) | |
tree | e424b2e3c4a4e2f63ac125e42c502d887d5827fc /py/objstr.c | |
parent | 26c0b155fa35d6518d985ed461a6f453a0afd4f4 (diff) |
py: Change vstr_null_terminate -> vstr_null_terminated_str, returns str.
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c index 1540e6226..43de047a7 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -856,7 +856,6 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa while (str < top && *str != '}' && *str != '!' && *str != ':') { vstr_add_char(field_name, *str++); } - vstr_null_terminate(field_name); } // conversion ::= "r" | "s" @@ -887,7 +886,6 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa while (str < top && *str != '}') { vstr_add_char(format_spec, *str++); } - vstr_null_terminate(format_spec); } } if (str >= top) { @@ -911,7 +909,7 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa if (field_name) { int index = 0; - const char *field = vstr_str(field_name); + const char *field = vstr_null_terminated_str(field_name); const char *lookup = NULL; if (MP_LIKELY(unichar_isdigit(*field))) { if (arg_i > 0) { @@ -999,7 +997,7 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa // precision ::= integer // type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%" - const char *s = vstr_str(format_spec); + const char *s = vstr_null_terminated_str(format_spec); if (isalignment(*s)) { align = *s++; } else if (*s && isalignment(s[1])) { |