format->align = ptr[1];
format->fill_char = ptr[0];
ptr += 2;
- } else if (end-ptr >= 1 && is_alignment_token(ptr[0])) {
+ }
+ else if (end-ptr >= 1 && is_alignment_token(ptr[0])) {
format->align = ptr[0];
ptr++;
}
/* always put a + or - */
r->n_lsign = 1;
r->lsign = (actual_sign == '-' ? '-' : '+');
- } else if (format->sign == '(') {
+ }
+ else if (format->sign == '(') {
if (actual_sign == '-') {
r->n_lsign = 1;
r->lsign = '(';
r->n_rsign = 1;
r->rsign = ')';
}
- } else if (format->sign == ' ') {
+ }
+ else if (format->sign == ' ') {
r->n_lsign = 1;
r->lsign = (actual_sign == '-' ? '-' : ' ');
- } else {
+ }
+ else {
/* non specified, or the default (-) */
if (actual_sign == '-') {
r->n_lsign = 1;
/* now the number of padding characters */
if (format->width == -1) {
/* no padding at all, nothing to do */
- } else {
+ }
+ else {
/* see if any padding is needed */
if (r->n_lsign + n_digits + r->n_rsign >= format->width) {
/* no padding needed, we're already bigger than the
requested width */
- } else {
+ }
+ else {
/* determine which of left, space, or right padding is
needed */
Py_ssize_t padding = format->width - (r->n_lsign + n_digits + r->n_rsign);
else if (format->align == '^') {
r->n_lpadding = padding / 2;
r->n_rpadding = padding - r->n_lpadding;
- } else
+ }
+ else
/* must be '=' */
r->n_spadding = padding;
}
if (len > width) {
width = len;
}
- } else {
+ }
+ else {
/* not specified, use all of the chars and no more */
width = len;
}
p = STRINGLIB_STR(result);
p[0] = (Py_UNICODE) x;
n_digits = len = 1;
- } else {
+ }
+ else {
int base;
int format_leading_chars_to_skip; /* characters added by
PyNumber_ToBase that we
}
Py_DECREF(key);
Py_INCREF(obj);
- } else {
+ }
+ else {
/* look up in args */
obj = PySequence_GetItem(args, index);
if (obj == NULL) {
return 1;
- } else {
+ }
+ else {
/* end of string, there's no format_spec or conversion */
field_name->end = str->ptr;
return 1;
PyErr_SetString(PyExc_ValueError, "unmatched '{' in format");
return 0;
- } else {
+ }
+ else {
/* literal text, read until the end of string, an escaped { or },
or an unescaped { */
while (self->str.ptr < self->str.end) {
/* escaped } or {, skip it in the input */
self->str.ptr++;
self->in_markup = 0;
- } else
+ }
+ else
len--;
}
SubString_init(&expanded_format_spec,
STRINGLIB_STR(tmp), STRINGLIB_LEN(tmp));
actual_format_spec = &expanded_format_spec;
- } else
+ }
+ else
actual_format_spec = format_spec;
if (render_field(fieldobj, actual_format_spec, output) == 0)
format_spec_needs_expanding, conversion, output,
args, kwargs, recursion_level))
return 0;
- } else {
+ }
+ else
if (!output_data(output, str.ptr, str.end-str.ptr))
return 0;
- }
}
return result;
}
/* all of the SubString objects point into it->str, so no
memory management needs to be done on them */
assert(0 <= result && result <= 2);
- if (result == 0 || result == 1) {
+ if (result == 0 || result == 1)
/* if 0, error has already been set, if 1, iterator is empty */
return NULL;
- } else {
+ else {
PyObject *is_markup_bool = NULL;
PyObject *literal_str = NULL;
PyObject *field_name_str = NULL;
if (conversion == '\0') {
conversion_str = Py_None;
Py_INCREF(conversion_str);
- } else
+ }
+ else
conversion_str = PyUnicode_FromUnicode(&conversion,
1);
if (conversion_str == NULL)
goto error;
- } else {
+ }
+ else {
/* only literal is returned */
literal_str = SubString_new_object(&literal);
if (literal_str == NULL)
result = FieldNameIterator_next(&it->it_field, &is_attr,
&idx, &name);
- if (result == 0 || result == 1) {
+ if (result == 0 || result == 1)
/* if 0, error has already been set, if 1, iterator is empty */
return NULL;
- } else {
+ else {
PyObject* result = NULL;
PyObject* is_attr_obj = NULL;
PyObject* obj = NULL;
&first, &first_idx, &it->it_field))
goto error;
- /* first becomes an integer, if possible, else a string */
+ /* first becomes an integer, if possible; else a string */
if (first_idx != -1)
first_obj = PyInt_FromSsize_t(first_idx);
else