aboutsummaryrefslogtreecommitdiff
path: root/py/objstr.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-07-04 02:13:27 +1000
committerDamien George <damien.p.george@gmail.com>2017-07-04 02:13:27 +1000
commit9d2c72ad4f62194b3c83ac9fae9f65329a34cdaf (patch)
treea3f7199166419fb3ff0a6cd7552a1061b7c2417a /py/objstr.c
parent2138258feaef3e65be8c85e19aaef57252672a64 (diff)
py/objstr: Remove unnecessary "sign" variable in formatting code.
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/py/objstr.c b/py/objstr.c
index b9cc1b1da..cea10770c 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1078,7 +1078,6 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
arg = mp_obj_new_str_from_vstr(&mp_type_str, &arg_vstr);
}
- char sign = '\0';
char fill = '\0';
char align = '\0';
int width = -1;
@@ -1114,7 +1113,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
} else if (*s == ' ') {
flags |= PF_FLAG_SPACE_SIGN;
}
- sign = *s++;
+ s++;
}
if (*s == '#') {
flags |= PF_FLAG_SHOW_PREFIX;
@@ -1160,7 +1159,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
fill = ' ';
}
- if (sign) {
+ if (flags & (PF_FLAG_SHOW_SIGN | PF_FLAG_SPACE_SIGN)) {
if (type == 's') {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
terse_str_format_value_error();
@@ -1176,8 +1175,6 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
"sign not allowed with integer format specifier 'c'");
}
}
- } else {
- sign = '-';
}
switch (align) {