diff --git a/class.c b/class.c index d0ee7a68fb..b4aeb59e25 100644 --- a/class.c +++ b/class.c @@ -1974,9 +1974,9 @@ rb_scan_args_parse(int kw_flag, int argc, const VALUE *argv, const char *fmt, st arg->last_idx = -1; arg->hash = Qnil; - switch(kw_flag) { + switch (kw_flag) { case RB_SCAN_ARGS_PASS_CALLED_KEYWORDS: - if(!(keyword_given = rb_keyword_given_p())) { + if (!(keyword_given = rb_keyword_given_p())) { empty_keyword_given = rb_empty_keyword_given_p(); } break; diff --git a/compile.c b/compile.c index 59ee138c0c..68c7e5a71d 100644 --- a/compile.c +++ b/compile.c @@ -3988,7 +3988,7 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int pop if (static_literal_node_p(node, iseq)) { /* count the elements that are optimizable */ const NODE *node_tmp = node->nd_next; - for(; node_tmp && static_literal_node_p(node_tmp, iseq); node_tmp = node_tmp->nd_next) + for (; node_tmp && static_literal_node_p(node_tmp, iseq); node_tmp = node_tmp->nd_next) count++; if ((first_chunk && stack_len == 0 && !node_tmp) || count >= min_tmp_ary_len) { @@ -4117,7 +4117,7 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popp if (static_literal_node_pair_p(node, iseq)) { /* count the elements that are optimizable */ const NODE *node_tmp = node->nd_next->nd_next; - for(; node_tmp && static_literal_node_pair_p(node_tmp, iseq); node_tmp = node_tmp->nd_next->nd_next) + for (; node_tmp && static_literal_node_pair_p(node_tmp, iseq); node_tmp = node_tmp->nd_next->nd_next) count++; if ((first_chunk && stack_len == 0 && !node_tmp) || count >= min_tmp_hash_len) { @@ -8968,7 +8968,8 @@ rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *storage) if (offset > storage->size || offset > storage->pos) { pos = 0; storage = storage->next; - } else { + } + else { #ifdef STRICT_ALIGNMENT pos += (int)padding; #endif /* STRICT_ALIGNMENT */ @@ -8979,12 +8980,12 @@ rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *storage) int j; const char *types = insn_op_types(iobj->insn_id); - for(j = 0; types[j]; j++) { + for (j = 0; types[j]; j++) { char type = types[j]; - switch(type) { - case TS_CDHASH: - case TS_ISEQ: - case TS_VALUE: + switch (type) { + case TS_CDHASH: + case TS_ISEQ: + case TS_VALUE: { VALUE op = OPERAND_AT(iobj, j); if (!SPECIAL_CONST_P(op)) { @@ -8992,8 +8993,8 @@ rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *storage) } break; } - default: - break; + default: + break; } } } diff --git a/eval.c b/eval.c index 5d402e5cb8..24228caccd 100644 --- a/eval.c +++ b/eval.c @@ -1648,8 +1648,8 @@ rb_mod_s_used_modules(VALUE _) const rb_cref_t *cref = rb_vm_cref(); VALUE ary = rb_ary_new(); - while(cref) { - if(!NIL_P(CREF_REFINEMENTS(cref))) { + while (cref) { + if (!NIL_P(CREF_REFINEMENTS(cref))) { rb_hash_foreach(CREF_REFINEMENTS(cref), used_modules_i, ary); } cref = CREF_NEXT(cref); diff --git a/file.c b/file.c index 1c14c7e702..b0056b0f99 100644 --- a/file.c +++ b/file.c @@ -4365,7 +4365,7 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, enum rb_realpath_mode mode } unresolved_path = TO_OSPATH(unresolved_path); - if((resolved_ptr = realpath(RSTRING_PTR(unresolved_path), NULL)) == NULL) { + if ((resolved_ptr = realpath(RSTRING_PTR(unresolved_path), NULL)) == NULL) { /* glibc realpath(3) does not allow /path/to/file.rb/../other_file.rb, returning ENOTDIR in that case. glibc realpath(3) can also return ENOENT for paths that exist, @@ -4398,9 +4398,9 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, enum rb_realpath_mode mode rb_enc_associate(resolved, origenc); } - if(rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { + if (rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { rb_enc_associate(resolved, rb_filesystem_encoding()); - if(rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { + if (rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { rb_enc_associate(resolved, rb_ascii8bit_encoding()); } } diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index bb7b889361..18901bbda4 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -2661,11 +2661,11 @@ rb_scan_args_set(int argc, const VALUE *argv, if (argi < argc) { argc_error: - if(tmp_buffer) rb_free_tmp_buffer(&tmp_buffer); + if (tmp_buffer) rb_free_tmp_buffer(&tmp_buffer); rb_error_arity(argc, n_mand, f_var ? UNLIMITED_ARGUMENTS : n_mand + n_opt); } - if(tmp_buffer) rb_free_tmp_buffer(&tmp_buffer); + if (tmp_buffer) rb_free_tmp_buffer(&tmp_buffer); return argc; } #endif diff --git a/iseq.c b/iseq.c index 03fe1ddaab..ae7b1cc30a 100644 --- a/iseq.c +++ b/iseq.c @@ -262,7 +262,7 @@ rb_iseq_update_references(rb_iseq_t *iseq) if (body->catch_table) { struct iseq_catch_table *table = body->catch_table; unsigned int i; - for(i = 0; i < table->size; i++) { + for (i = 0; i < table->size; i++) { struct iseq_catch_table_entry *entry; entry = UNALIGNED_MEMBER_PTR(table, entries[i]); if (entry->iseq) { @@ -321,7 +321,7 @@ rb_iseq_mark(const rb_iseq_t *iseq) if (body->catch_table) { const struct iseq_catch_table *table = body->catch_table; unsigned int i; - for(i = 0; i < table->size; i++) { + for (i = 0; i < table->size; i++) { const struct iseq_catch_table_entry *entry; entry = UNALIGNED_MEMBER_PTR(table, entries[i]); if (entry->iseq) { diff --git a/node.c b/node.c index ee6a356b06..8f42f7e5a5 100644 --- a/node.c +++ b/node.c @@ -1194,20 +1194,20 @@ rb_ast_newnode(rb_ast_t *ast, enum node_type type) { node_buffer_t *nb = ast->node_buffer; switch (type) { - case NODE_MATCH: - case NODE_LIT: - case NODE_STR: - case NODE_XSTR: - case NODE_DSTR: - case NODE_DXSTR: - case NODE_DREGX: - case NODE_DSYM: - case NODE_ARGS: - case NODE_SCOPE: - case NODE_ARYPTN: - return ast_newnode_in_bucket(&nb->markable); - default: - return ast_newnode_in_bucket(&nb->unmarkable); + case NODE_MATCH: + case NODE_LIT: + case NODE_STR: + case NODE_XSTR: + case NODE_DSTR: + case NODE_DXSTR: + case NODE_DREGX: + case NODE_DSYM: + case NODE_ARGS: + case NODE_SCOPE: + case NODE_ARYPTN: + return ast_newnode_in_bucket(&nb->markable); + default: + return ast_newnode_in_bucket(&nb->unmarkable); } } @@ -1257,7 +1257,7 @@ static void mark_ast_value(void *ctx, NODE * node) { switch (nd_type(node)) { - case NODE_SCOPE: + case NODE_SCOPE: { ID *buf = node->nd_tbl; if (buf) { @@ -1266,30 +1266,30 @@ mark_ast_value(void *ctx, NODE * node) } break; } - case NODE_ARYPTN: + case NODE_ARYPTN: { struct rb_ary_pattern_info *apinfo = node->nd_apinfo; rb_gc_mark_movable(apinfo->imemo); break; } - case NODE_ARGS: + case NODE_ARGS: { struct rb_args_info *args = node->nd_ainfo; rb_gc_mark_movable(args->imemo); break; } - case NODE_MATCH: - case NODE_LIT: - case NODE_STR: - case NODE_XSTR: - case NODE_DSTR: - case NODE_DXSTR: - case NODE_DREGX: - case NODE_DSYM: - rb_gc_mark_movable(node->nd_lit); - break; - default: - rb_bug("unreachable node %s", ruby_node_name(nd_type(node))); + case NODE_MATCH: + case NODE_LIT: + case NODE_STR: + case NODE_XSTR: + case NODE_DSTR: + case NODE_DXSTR: + case NODE_DREGX: + case NODE_DSYM: + rb_gc_mark_movable(node->nd_lit); + break; + default: + rb_bug("unreachable node %s", ruby_node_name(nd_type(node))); } } @@ -1297,7 +1297,7 @@ static void update_ast_value(void *ctx, NODE * node) { switch (nd_type(node)) { - case NODE_SCOPE: + case NODE_SCOPE: { ID *buf = node->nd_tbl; if (buf) { @@ -1306,29 +1306,29 @@ update_ast_value(void *ctx, NODE * node) } break; } - case NODE_ARYPTN: + case NODE_ARYPTN: { struct rb_ary_pattern_info *apinfo = node->nd_apinfo; apinfo->imemo = rb_gc_location(apinfo->imemo); break; } - case NODE_ARGS: + case NODE_ARGS: { struct rb_args_info *args = node->nd_ainfo; args->imemo = rb_gc_location(args->imemo); break; } - case NODE_LIT: - case NODE_STR: - case NODE_XSTR: - case NODE_DSTR: - case NODE_DXSTR: - case NODE_DREGX: - case NODE_DSYM: - node->nd_lit = rb_gc_location(node->nd_lit); - break; - default: - rb_bug("unreachable"); + case NODE_LIT: + case NODE_STR: + case NODE_XSTR: + case NODE_DSTR: + case NODE_DXSTR: + case NODE_DREGX: + case NODE_DSYM: + node->nd_lit = rb_gc_location(node->nd_lit); + break; + default: + rb_bug("unreachable"); } } diff --git a/random.c b/random.c index 07ad2361f5..f72abb0a6c 100644 --- a/random.c +++ b/random.c @@ -311,7 +311,7 @@ fill_random_bytes_urandom(void *seed, size_t size) return -1; } offset += (size_t)ret; - } while(offset < size); + } while (offset < size); } close(fd); return 0; @@ -421,7 +421,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int need_secure) return -1; } offset += (size_t)ret; - } while(offset < size); + } while (offset < size); return 0; } return -1; diff --git a/thread_sync.c b/thread_sync.c index afeaaa464e..492a44992e 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -292,7 +292,8 @@ do_mutex_lock(VALUE self, int interruptible_p) mutex->th = th; mutex_locked(th, self); } - } else { + } + else { if (mutex->th == th) mutex_locked(th, self); } } diff --git a/vm_dump.c b/vm_dump.c index 8ae55aa335..4d7bd54444 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -1011,7 +1011,8 @@ rb_vm_bugreport(const void *ctx) if (map.is_submap) { // We only look at main addresses depth++; - } else { + } + else { fprintf(stderr, "%lx-%lx %s%s%s", addr, (addr+size), ((map.protection & VM_PROT_READ) != 0 ? "r" : "-"), ((map.protection & VM_PROT_WRITE) != 0 ? "w" : "-"), diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 49e865d96f..85b4e3f044 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -4384,13 +4384,16 @@ vm_opt_nil_p(CALL_INFO ci, CALL_CACHE cc, VALUE recv) if (recv == Qnil) { if (BASIC_OP_UNREDEFINED_P(BOP_NIL_P, NIL_REDEFINED_OP_FLAG)) { return Qtrue; - } else { + } + else { return Qundef; } - } else { + } + else { if (vm_method_cfunc_is(ci, cc, recv, rb_false)) { return Qfalse; - } else { + } + else { return Qundef; } } diff --git a/win32/win32.c b/win32/win32.c index af3c45ab62..49137bcc6d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -351,7 +351,7 @@ flock_winnt(uintptr_t self, int argc, uintptr_t* argv) memset(&o, 0, sizeof(o)); - switch(oper) { + switch (oper) { case LOCK_SH: /* shared lock */ LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, LK_LEN, &o), i); break;