summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-04-03 16:56:27 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-04-03 16:56:27 +0900
commit77331d127b6ab202e703bd7297ab6aabf4a314e9 (patch)
treee86c5ee7c9f4a5a867d63745607f525116b84d19 /src/string.c
parentfbf4089d2f9480b5f5c9b8cdc312ad5e8417f62e (diff)
downloadmruby-77331d127b6ab202e703bd7297ab6aabf4a314e9.tar.gz
mruby-77331d127b6ab202e703bd7297ab6aabf4a314e9.zip
Unify `else` clause style
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/string.c b/src/string.c
index 11abdc051..742046361 100644
--- a/src/string.c
+++ b/src/string.c
@@ -63,7 +63,8 @@ str_new(mrb_state *mrb, const char *p, size_t len)
if (p) {
memcpy(s->as.ary, p, len);
}
- } else {
+ }
+ else {
if (len >= MRB_INT_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
@@ -2029,7 +2030,8 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
if (pat_len > 0) {
end = mrb_memsearch(RSTRING_PTR(spat), pat_len, RSTRING_PTR(str)+idx, str_len - idx);
if (end < 0) break;
- } else {
+ }
+ else {
end = chars2bytes(str, idx, 1);
}
mrb_ary_push(mrb, result, byte_subseq(mrb, str, idx, end));
@@ -2852,7 +2854,8 @@ mrb_float_read(const char *string, char **endPtr)
if (*p == '-') {
sign = TRUE;
p += 1;
- } else {
+ }
+ else {
if (*p == '+') {
p += 1;
}
@@ -2888,24 +2891,28 @@ mrb_float_read(const char *string, char **endPtr)
p -= mantSize;
if (decPt < 0) {
decPt = mantSize;
- } else {
+ }
+ else {
mantSize -= 1; /* One of the digits was the point. */
}
if (mantSize > 18) {
if (decPt - 18 > 29999) {
fracExp = 29999;
- } else {
+ }
+ else {
fracExp = decPt - 18;
}
mantSize = 18;
- } else {
+ }
+ else {
fracExp = decPt - mantSize;
}
if (mantSize == 0) {
fraction = 0.0;
p = string;
goto done;
- } else {
+ }
+ else {
int frac1, frac2;
frac1 = 0;
for ( ; mantSize > 9; mantSize -= 1)
@@ -2942,7 +2949,8 @@ mrb_float_read(const char *string, char **endPtr)
if (*p == '-') {
expSign = TRUE;
p += 1;
- } else {
+ }
+ else {
if (*p == '+') {
p += 1;
}
@@ -2958,7 +2966,8 @@ mrb_float_read(const char *string, char **endPtr)
}
if (expSign) {
exp = fracExp - exp;
- } else {
+ }
+ else {
exp = fracExp + exp;
}
@@ -2972,7 +2981,8 @@ mrb_float_read(const char *string, char **endPtr)
if (exp < 0) {
expSign = TRUE;
exp = -exp;
- } else {
+ }
+ else {
expSign = FALSE;
}
if (exp > maxExponent) {
@@ -2987,7 +2997,8 @@ mrb_float_read(const char *string, char **endPtr)
}
if (expSign) {
fraction /= dblExp;
- } else {
+ }
+ else {
fraction *= dblExp;
}