Skip to content

Commit f69b9d3

Browse files
committed
objstr: str_uni_istype(): Codestyle.
1 parent 69a8b23 commit f69b9d3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

py/objstr.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,9 @@ enum { IS_SPACE, IS_ALPHA, IS_DIGIT, IS_UPPER, IS_LOWER };
15071507
STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15081508
GET_STR_DATA_LEN(self_in, self_data, self_len);
15091509

1510-
if (self_len == 0) return mp_const_false; // default to False for empty str
1510+
if (self_len == 0) {
1511+
return mp_const_false; // default to False for empty str
1512+
}
15111513

15121514
typedef bool (*check_function)(unichar);
15131515
check_function f;
@@ -1522,7 +1524,9 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15221524
}
15231525

15241526
for (int i = 0; i < self_len; i++) {
1525-
if (!f(*self_data++)) return mp_const_false;
1527+
if (!f(*self_data++)) {
1528+
return mp_const_false;
1529+
}
15261530
}
15271531
} else {
15281532
switch (type) {
@@ -1537,11 +1541,15 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15371541
for (int i = 0; i < self_len; i++) { // only check alphanumeric characters
15381542
if (unichar_isalpha(*self_data++)) {
15391543
contains_alpha = true;
1540-
if (!f(*(self_data-1))) return mp_const_false; // we already incremented
1544+
if (!f(*(self_data-1))) {
1545+
return mp_const_false; // we already incremented
1546+
}
15411547
}
15421548
}
15431549

1544-
if (!(contains_alpha)) return mp_const_false;
1550+
if (!contains_alpha) {
1551+
return mp_const_false;
1552+
}
15451553
}
15461554

15471555
return mp_const_true;

0 commit comments

Comments
 (0)