py/objstr: Remove unnecessary "sign" variable in formatting code.
This commit is contained in:
parent
2138258fea
commit
9d2c72ad4f
|
@ -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);
|
arg = mp_obj_new_str_from_vstr(&mp_type_str, &arg_vstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char sign = '\0';
|
|
||||||
char fill = '\0';
|
char fill = '\0';
|
||||||
char align = '\0';
|
char align = '\0';
|
||||||
int width = -1;
|
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 == ' ') {
|
} else if (*s == ' ') {
|
||||||
flags |= PF_FLAG_SPACE_SIGN;
|
flags |= PF_FLAG_SPACE_SIGN;
|
||||||
}
|
}
|
||||||
sign = *s++;
|
s++;
|
||||||
}
|
}
|
||||||
if (*s == '#') {
|
if (*s == '#') {
|
||||||
flags |= PF_FLAG_SHOW_PREFIX;
|
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 = ' ';
|
fill = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sign) {
|
if (flags & (PF_FLAG_SHOW_SIGN | PF_FLAG_SPACE_SIGN)) {
|
||||||
if (type == 's') {
|
if (type == 's') {
|
||||||
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
|
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
|
||||||
terse_str_format_value_error();
|
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'");
|
"sign not allowed with integer format specifier 'c'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
sign = '-';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (align) {
|
switch (align) {
|
||||||
|
|
Loading…
Reference in New Issue