summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-31 10:59:34 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-31 10:59:34 +0300
commitf69b9d379cfd88536865ce47d09ef7dde9564ac7 (patch)
tree58086a5decb4a80050130373e10fec222734b5a9
parent69a8b236514681cdc4e8969d73709128c094cab0 (diff)
downloadmicropython-f69b9d379cfd88536865ce47d09ef7dde9564ac7.tar.gz
micropython-f69b9d379cfd88536865ce47d09ef7dde9564ac7.zip
objstr: str_uni_istype(): Codestyle.
-rw-r--r--py/objstr.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c
index 729ed7a855..91c8ddeb13 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1507,7 +1507,9 @@ enum { IS_SPACE, IS_ALPHA, IS_DIGIT, IS_UPPER, IS_LOWER };
STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
GET_STR_DATA_LEN(self_in, self_data, self_len);
- if (self_len == 0) return mp_const_false; // default to False for empty str
+ if (self_len == 0) {
+ return mp_const_false; // default to False for empty str
+ }
typedef bool (*check_function)(unichar);
check_function f;
@@ -1522,7 +1524,9 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
}
for (int i = 0; i < self_len; i++) {
- if (!f(*self_data++)) return mp_const_false;
+ if (!f(*self_data++)) {
+ return mp_const_false;
+ }
}
} else {
switch (type) {
@@ -1537,11 +1541,15 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
for (int i = 0; i < self_len; i++) { // only check alphanumeric characters
if (unichar_isalpha(*self_data++)) {
contains_alpha = true;
- if (!f(*(self_data-1))) return mp_const_false; // we already incremented
+ if (!f(*(self_data-1))) {
+ return mp_const_false; // we already incremented
+ }
}
}
- if (!(contains_alpha)) return mp_const_false;
+ if (!contains_alpha) {
+ return mp_const_false;
+ }
}
return mp_const_true;