Adjusted spaces [ci skip]

This commit is contained in:
Nobuyoshi Nakada 2019-09-27 10:20:56 +09:00
parent 293c6c8cc3
commit 0c6f36668a
No known key found for this signature in database
GPG Key ID: 4BC7D6DF58D8DF60
12 changed files with 78 additions and 72 deletions

View File

@ -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;

View File

@ -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;
}
}
}

4
eval.c
View File

@ -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);

6
file.c
View File

@ -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());
}
}

View File

@ -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

4
iseq.c
View File

@ -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) {

86
node.c
View File

@ -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");
}
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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" : "-"),

View File

@ -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;
}
}

View File

@ -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;