diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-04-03 16:56:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-04-03 16:56:27 +0900 |
| commit | 77331d127b6ab202e703bd7297ab6aabf4a314e9 (patch) | |
| tree | e86c5ee7c9f4a5a867d63745607f525116b84d19 /mrbgems | |
| parent | fbf4089d2f9480b5f5c9b8cdc312ad5e8417f62e (diff) | |
| download | mruby-77331d127b6ab202e703bd7297ab6aabf4a314e9.tar.gz mruby-77331d127b6ab202e703bd7297ab6aabf4a314e9.zip | |
Unify `else` clause style
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c | 6 | ||||
| -rw-r--r-- | mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c | 24 | ||||
| -rw-r--r-- | mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c | 6 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 3 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 6 | ||||
| -rw-r--r-- | mrbgems/mruby-sprintf/src/sprintf.c | 3 | ||||
| -rw-r--r-- | mrbgems/mruby-string-ext/src/string.c | 15 | ||||
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 3 |
8 files changed, 44 insertions, 22 deletions
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c index 0c5002feb..4553a965a 100644 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c @@ -31,7 +31,8 @@ check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno) return lineno; } } - } else { + } + else { for (l_idx = 0; l_idx < count; ++l_idx) { if (lineno == info_file->lines.flat_map[l_idx].line) { return lineno; @@ -198,7 +199,8 @@ mrb_debug_set_break_line(mrb_state *mrb, mrb_debug_context *dbg, const char *fil result = check_file_lineno(dbg->root_irep, file, lineno); if (result == 0) { return MRB_DEBUG_BREAK_INVALID_FILE; - }else if (result == MRB_DEBUG_BP_FILE_OK) { + } + else if (result == MRB_DEBUG_BP_FILE_OK) { return MRB_DEBUG_BREAK_INVALID_LINENO; } diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c index 27022369a..6bbe4cfbb 100644 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c @@ -259,7 +259,8 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c if ((body = strrchr(args, ':')) == NULL) { body = args; type = check_bptype(body); - } else { + } + else { if (body == args) { printf(BREAK_ERR_MSG_INVALIDSTR, args); return MRB_DEBUG_BPTYPE_NONE; @@ -274,7 +275,8 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c if (l <= 65535) { *line = l; *file = (body == args)? mrb_debug_get_filename(dbg->irep, (uint32_t)(dbg->pc - dbg->irep->iseq)): args; - } else { + } + else { puts(BREAK_ERR_MSG_RANGEOVER); type = MRB_DEBUG_BPTYPE_NONE; } @@ -285,11 +287,13 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c if (ISUPPER(*body)||ISLOWER(*body)||(*body == '_')) { *method = body; *cname = NULL; - } else { + } + else { printf(BREAK_ERR_MSG_INVALIDMETHOD, args); type = MRB_DEBUG_BPTYPE_NONE; } - } else { + } + else { if (ISUPPER(*args)) { switch(*body) { case '@': case '$': case '?': case '.': case ',': case ':': @@ -302,7 +306,8 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c *cname = args; break; } - } else { + } + else { printf(BREAK_ERR_MSG_INVALIDCLASS, args); type = MRB_DEBUG_BPTYPE_NONE; } @@ -343,12 +348,15 @@ dbgcmd_break(mrb_state *mrb, mrdb_state *mrdb) if (ret >= 0) { if (type == MRB_DEBUG_BPTYPE_LINE) { printf(BREAK_SET_MSG_LINE, ret, file, line); - } else if ((type == MRB_DEBUG_BPTYPE_METHOD)&&(cname == NULL)) { + } + else if ((type == MRB_DEBUG_BPTYPE_METHOD)&&(cname == NULL)) { printf(BREAK_SET_MSG_METHOD, ret, method); - } else { + } + else { printf(BREAK_SET_MSG_CLASS_METHOD, ret, cname, method); } - } else { + } + else { switch (ret) { case MRB_DEBUG_BREAK_INVALID_LINENO: printf(BREAK_ERR_MSG_INVALIDLINENO, line, file); diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c index 1aefb691d..cb4c738fc 100644 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c @@ -13,7 +13,8 @@ dbgcmd_run(mrb_state *mrb, mrdb_state *mrdb) if (dbg->xm == DBG_INIT){ dbg->xm = DBG_RUN; - } else { + } + else { dbg->xm = DBG_QUIT; if (dbg->xphase == DBG_PHASE_RUNNING){ struct RClass *exc; @@ -40,7 +41,8 @@ dbgcmd_continue(mrb_state *mrb, mrdb_state *mrdb) if (dbg->xphase == DBG_PHASE_AFTER_RUN){ puts("The program is not running."); dbg->xm = DBG_QUIT; - } else { + } + else { dbg->xm = DBG_RUN; } return DBGST_CONTINUE; diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 75c42eefb..64f4702a7 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -2445,7 +2445,8 @@ codegen(codegen_scope *s, node *tree, int val) if (p2) { off = new_lit(s, mrb_str_new_cstr(s->mrb, p2)); genop(s, MKOP_ABx(OP_STRING, cursp(), off)); - } else { + } + else { genop(s, MKOP_A(OP_LOADNIL, cursp())); } argc++; diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 41984b186..226701b52 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -4124,12 +4124,14 @@ parse_string(parser_state *p) } if (flag > flags) { dup = strndup(flags, (size_t)(flag - flags)); - } else { + } + else { dup = NULL; } if (enc) { encp = strndup(&enc, 1); - } else { + } + else { encp = NULL; } pylval.nd = new_regx(p, s, dup, encp); diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c index a7de2a5b8..3d96573a7 100644 --- a/mrbgems/mruby-sprintf/src/sprintf.c +++ b/mrbgems/mruby-sprintf/src/sprintf.c @@ -750,7 +750,8 @@ retry: mrb_int tmp_n = len; RSTRING(result)->flags &= ~MRB_STR_EMBED_LEN_MASK; RSTRING(result)->flags |= tmp_n << MRB_STR_EMBED_LEN_SHIFT; - } else { + } + else { RSTRING(result)->as.heap.len = blen; } if (flags&(FPREC|FWIDTH)) { diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index 7e87b3db4..402dbf987 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -387,7 +387,8 @@ mrb_str_succ_bang(mrb_state *mrb, mrb_value self) if (e < b) { e = p + l - 1; result = mrb_str_new_lit(mrb, ""); - } else { + } + else { // find leading letter of the ascii/number b = e; while (b > p) { @@ -405,7 +406,8 @@ mrb_str_succ_bang(mrb_state *mrb, mrb_value self) if (*e == 0xff) { mrb_str_cat_lit(mrb, result, "\x01"); (*e) = 0; - } else + } + else (*e)++; break; } @@ -413,13 +415,16 @@ mrb_str_succ_bang(mrb_state *mrb, mrb_value self) if (*e == '9') { if (e == b) prepend = "1"; *e = '0'; - } else if (*e == 'z') { + } + else if (*e == 'z') { if (e == b) prepend = "a"; *e = 'a'; - } else if (*e == 'Z') { + } + else if (*e == 'Z') { if (e == b) prepend = "A"; *e = 'A'; - } else { + } + else { (*e)++; break; } diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index de94f7137..aae1e2626 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -17,7 +17,8 @@ double round(double x) { if (x >= 0.0) { return (double)((int)(x + 0.5)); - } else { + } + else { return (double)((int)(x - 0.5)); } } |
