1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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->last_idx = -1;
arg->hash = Qnil; arg->hash = Qnil;
switch(kw_flag) { switch (kw_flag) {
case RB_SCAN_ARGS_PASS_CALLED_KEYWORDS: 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(); empty_keyword_given = rb_empty_keyword_given_p();
} }
break; 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)) { if (static_literal_node_p(node, iseq)) {
/* count the elements that are optimizable */ /* count the elements that are optimizable */
const NODE *node_tmp = node->nd_next; 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++; count++;
if ((first_chunk && stack_len == 0 && !node_tmp) || count >= min_tmp_ary_len) { 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)) { if (static_literal_node_pair_p(node, iseq)) {
/* count the elements that are optimizable */ /* count the elements that are optimizable */
const NODE *node_tmp = node->nd_next->nd_next; 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++; count++;
if ((first_chunk && stack_len == 0 && !node_tmp) || count >= min_tmp_hash_len) { 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) { if (offset > storage->size || offset > storage->pos) {
pos = 0; pos = 0;
storage = storage->next; storage = storage->next;
} else { }
else {
#ifdef STRICT_ALIGNMENT #ifdef STRICT_ALIGNMENT
pos += (int)padding; pos += (int)padding;
#endif /* STRICT_ALIGNMENT */ #endif /* STRICT_ALIGNMENT */
@ -8979,12 +8980,12 @@ rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *storage)
int j; int j;
const char *types = insn_op_types(iobj->insn_id); 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]; char type = types[j];
switch(type) { switch (type) {
case TS_CDHASH: case TS_CDHASH:
case TS_ISEQ: case TS_ISEQ:
case TS_VALUE: case TS_VALUE:
{ {
VALUE op = OPERAND_AT(iobj, j); VALUE op = OPERAND_AT(iobj, j);
if (!SPECIAL_CONST_P(op)) { if (!SPECIAL_CONST_P(op)) {
@ -8992,8 +8993,8 @@ rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *storage)
} }
break; break;
} }
default: default:
break; break;
} }
} }
} }

4
eval.c
View file

@ -1648,8 +1648,8 @@ rb_mod_s_used_modules(VALUE _)
const rb_cref_t *cref = rb_vm_cref(); const rb_cref_t *cref = rb_vm_cref();
VALUE ary = rb_ary_new(); VALUE ary = rb_ary_new();
while(cref) { while (cref) {
if(!NIL_P(CREF_REFINEMENTS(cref))) { if (!NIL_P(CREF_REFINEMENTS(cref))) {
rb_hash_foreach(CREF_REFINEMENTS(cref), used_modules_i, ary); rb_hash_foreach(CREF_REFINEMENTS(cref), used_modules_i, ary);
} }
cref = CREF_NEXT(cref); 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); 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, /* glibc realpath(3) does not allow /path/to/file.rb/../other_file.rb,
returning ENOTDIR in that case. returning ENOTDIR in that case.
glibc realpath(3) can also return ENOENT for paths that exist, 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); 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()); 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()); 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) { if (argi < argc) {
argc_error: 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); 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; return argc;
} }
#endif #endif

4
iseq.c
View file

@ -262,7 +262,7 @@ rb_iseq_update_references(rb_iseq_t *iseq)
if (body->catch_table) { if (body->catch_table) {
struct iseq_catch_table *table = body->catch_table; struct iseq_catch_table *table = body->catch_table;
unsigned int i; unsigned int i;
for(i = 0; i < table->size; i++) { for (i = 0; i < table->size; i++) {
struct iseq_catch_table_entry *entry; struct iseq_catch_table_entry *entry;
entry = UNALIGNED_MEMBER_PTR(table, entries[i]); entry = UNALIGNED_MEMBER_PTR(table, entries[i]);
if (entry->iseq) { if (entry->iseq) {
@ -321,7 +321,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
if (body->catch_table) { if (body->catch_table) {
const struct iseq_catch_table *table = body->catch_table; const struct iseq_catch_table *table = body->catch_table;
unsigned int i; unsigned int i;
for(i = 0; i < table->size; i++) { for (i = 0; i < table->size; i++) {
const struct iseq_catch_table_entry *entry; const struct iseq_catch_table_entry *entry;
entry = UNALIGNED_MEMBER_PTR(table, entries[i]); entry = UNALIGNED_MEMBER_PTR(table, entries[i]);
if (entry->iseq) { 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; node_buffer_t *nb = ast->node_buffer;
switch (type) { switch (type) {
case NODE_MATCH: case NODE_MATCH:
case NODE_LIT: case NODE_LIT:
case NODE_STR: case NODE_STR:
case NODE_XSTR: case NODE_XSTR:
case NODE_DSTR: case NODE_DSTR:
case NODE_DXSTR: case NODE_DXSTR:
case NODE_DREGX: case NODE_DREGX:
case NODE_DSYM: case NODE_DSYM:
case NODE_ARGS: case NODE_ARGS:
case NODE_SCOPE: case NODE_SCOPE:
case NODE_ARYPTN: case NODE_ARYPTN:
return ast_newnode_in_bucket(&nb->markable); return ast_newnode_in_bucket(&nb->markable);
default: default:
return ast_newnode_in_bucket(&nb->unmarkable); return ast_newnode_in_bucket(&nb->unmarkable);
} }
} }
@ -1257,7 +1257,7 @@ static void
mark_ast_value(void *ctx, NODE * node) mark_ast_value(void *ctx, NODE * node)
{ {
switch (nd_type(node)) { switch (nd_type(node)) {
case NODE_SCOPE: case NODE_SCOPE:
{ {
ID *buf = node->nd_tbl; ID *buf = node->nd_tbl;
if (buf) { if (buf) {
@ -1266,30 +1266,30 @@ mark_ast_value(void *ctx, NODE * node)
} }
break; break;
} }
case NODE_ARYPTN: case NODE_ARYPTN:
{ {
struct rb_ary_pattern_info *apinfo = node->nd_apinfo; struct rb_ary_pattern_info *apinfo = node->nd_apinfo;
rb_gc_mark_movable(apinfo->imemo); rb_gc_mark_movable(apinfo->imemo);
break; break;
} }
case NODE_ARGS: case NODE_ARGS:
{ {
struct rb_args_info *args = node->nd_ainfo; struct rb_args_info *args = node->nd_ainfo;
rb_gc_mark_movable(args->imemo); rb_gc_mark_movable(args->imemo);
break; break;
} }
case NODE_MATCH: case NODE_MATCH:
case NODE_LIT: case NODE_LIT:
case NODE_STR: case NODE_STR:
case NODE_XSTR: case NODE_XSTR:
case NODE_DSTR: case NODE_DSTR:
case NODE_DXSTR: case NODE_DXSTR:
case NODE_DREGX: case NODE_DREGX:
case NODE_DSYM: case NODE_DSYM:
rb_gc_mark_movable(node->nd_lit); rb_gc_mark_movable(node->nd_lit);
break; break;
default: default:
rb_bug("unreachable node %s", ruby_node_name(nd_type(node))); rb_bug("unreachable node %s", ruby_node_name(nd_type(node)));
} }
} }
@ -1297,7 +1297,7 @@ static void
update_ast_value(void *ctx, NODE * node) update_ast_value(void *ctx, NODE * node)
{ {
switch (nd_type(node)) { switch (nd_type(node)) {
case NODE_SCOPE: case NODE_SCOPE:
{ {
ID *buf = node->nd_tbl; ID *buf = node->nd_tbl;
if (buf) { if (buf) {
@ -1306,29 +1306,29 @@ update_ast_value(void *ctx, NODE * node)
} }
break; break;
} }
case NODE_ARYPTN: case NODE_ARYPTN:
{ {
struct rb_ary_pattern_info *apinfo = node->nd_apinfo; struct rb_ary_pattern_info *apinfo = node->nd_apinfo;
apinfo->imemo = rb_gc_location(apinfo->imemo); apinfo->imemo = rb_gc_location(apinfo->imemo);
break; break;
} }
case NODE_ARGS: case NODE_ARGS:
{ {
struct rb_args_info *args = node->nd_ainfo; struct rb_args_info *args = node->nd_ainfo;
args->imemo = rb_gc_location(args->imemo); args->imemo = rb_gc_location(args->imemo);
break; break;
} }
case NODE_LIT: case NODE_LIT:
case NODE_STR: case NODE_STR:
case NODE_XSTR: case NODE_XSTR:
case NODE_DSTR: case NODE_DSTR:
case NODE_DXSTR: case NODE_DXSTR:
case NODE_DREGX: case NODE_DREGX:
case NODE_DSYM: case NODE_DSYM:
node->nd_lit = rb_gc_location(node->nd_lit); node->nd_lit = rb_gc_location(node->nd_lit);
break; break;
default: default:
rb_bug("unreachable"); rb_bug("unreachable");
} }
} }

View file

@ -311,7 +311,7 @@ fill_random_bytes_urandom(void *seed, size_t size)
return -1; return -1;
} }
offset += (size_t)ret; offset += (size_t)ret;
} while(offset < size); } while (offset < size);
} }
close(fd); close(fd);
return 0; return 0;
@ -421,7 +421,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int need_secure)
return -1; return -1;
} }
offset += (size_t)ret; offset += (size_t)ret;
} while(offset < size); } while (offset < size);
return 0; return 0;
} }
return -1; return -1;

View file

@ -292,7 +292,8 @@ do_mutex_lock(VALUE self, int interruptible_p)
mutex->th = th; mutex->th = th;
mutex_locked(th, self); mutex_locked(th, self);
} }
} else { }
else {
if (mutex->th == th) mutex_locked(th, self); if (mutex->th == th) mutex_locked(th, self);
} }
} }

View file

@ -1011,7 +1011,8 @@ rb_vm_bugreport(const void *ctx)
if (map.is_submap) { if (map.is_submap) {
// We only look at main addresses // We only look at main addresses
depth++; depth++;
} else { }
else {
fprintf(stderr, "%lx-%lx %s%s%s", addr, (addr+size), fprintf(stderr, "%lx-%lx %s%s%s", addr, (addr+size),
((map.protection & VM_PROT_READ) != 0 ? "r" : "-"), ((map.protection & VM_PROT_READ) != 0 ? "r" : "-"),
((map.protection & VM_PROT_WRITE) != 0 ? "w" : "-"), ((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 (recv == Qnil) {
if (BASIC_OP_UNREDEFINED_P(BOP_NIL_P, NIL_REDEFINED_OP_FLAG)) { if (BASIC_OP_UNREDEFINED_P(BOP_NIL_P, NIL_REDEFINED_OP_FLAG)) {
return Qtrue; return Qtrue;
} else { }
else {
return Qundef; return Qundef;
} }
} else { }
else {
if (vm_method_cfunc_is(ci, cc, recv, rb_false)) { if (vm_method_cfunc_is(ci, cc, recv, rb_false)) {
return Qfalse; return Qfalse;
} else { }
else {
return Qundef; return Qundef;
} }
} }

View file

@ -351,7 +351,7 @@ flock_winnt(uintptr_t self, int argc, uintptr_t* argv)
memset(&o, 0, sizeof(o)); memset(&o, 0, sizeof(o));
switch(oper) { switch (oper) {
case LOCK_SH: /* shared lock */ case LOCK_SH: /* shared lock */
LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, LK_LEN, &o), i); LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, LK_LEN, &o), i);
break; break;