Fix style [ci skip]

This commit is contained in:
Nobuyoshi Nakada 2025-04-19 22:02:10 +09:00
parent d6d4e6877c
commit c218862d3c
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
14 changed files with 63 additions and 33 deletions

View File

@ -1065,7 +1065,8 @@ complex_pow_for_special_angle(VALUE self, VALUE other)
else if (f_eqeq_p(dat->real, f_negate(dat->imag))) {
x = dat->imag;
dir = 3;
} else {
}
else {
dir = 0;
}

3
enum.c
View File

@ -324,7 +324,8 @@ enum_count(int argc, VALUE *argv, VALUE obj)
NORETURN(static void found(VALUE i, VALUE memop));
static void
found(VALUE i, VALUE memop) {
found(VALUE i, VALUE memop)
{
struct MEMO *memo = MEMO_CAST(memop);
MEMO_V1_SET(memo, i);
memo->u3.cnt = 1;

View File

@ -4195,7 +4195,8 @@ rb_warn_unchilled_literal(VALUE obj)
VALUE created = get_created_info(str, &line);
if (NIL_P(created)) {
rb_str_cat2(mesg, " (run with --debug-frozen-string-literal for more information)\n");
} else {
}
else {
rb_str_cat2(mesg, "\n");
rb_str_append(mesg, created);
if (line) rb_str_catf(mesg, ":%d", line);

3
gc.c
View File

@ -990,7 +990,8 @@ rb_gc_obj_slot_size(VALUE obj)
}
static inline void
gc_validate_pc(void) {
gc_validate_pc(void)
{
#if RUBY_DEBUG
rb_execution_context_t *ec = GET_EC();
const rb_control_frame_t *cfp = ec->cfp;

13
io.c
View File

@ -1185,7 +1185,8 @@ io_internal_wait(VALUE thread, rb_io_t *fptr, int error, int events, struct time
if (error) {
errno = error;
return -1;
} else {
}
else {
// Otherwise, whatever error was generated by `nogvl_wait_for` is the one we want:
return ready;
}
@ -10987,11 +10988,11 @@ rb_io_advise(int argc, VALUE *argv, VALUE io)
static int
is_pos_inf(VALUE x)
{
double f;
if (!RB_FLOAT_TYPE_P(x))
return 0;
f = RFLOAT_VALUE(x);
return isinf(f) && 0 < f;
double f;
if (!RB_FLOAT_TYPE_P(x))
return 0;
f = RFLOAT_VALUE(x);
return isinf(f) && 0 < f;
}
/*

3
iseq.c
View File

@ -1842,7 +1842,8 @@ iseqw_s_compile_file_prism(int argc, VALUE *argv, VALUE self)
rb_vm_pop_frame(ec);
RB_GC_GUARD(v);
return ret;
} else {
}
else {
pm_parse_result_free(&result);
rb_vm_pop_frame(ec);
RB_GC_GUARD(v);

View File

@ -594,14 +594,18 @@ struct fstring_table_probe {
int mask;
};
static int fstring_table_probe_start(struct fstring_table_probe *probe, struct fstring_table_struct *table, VALUE hash_code) {
static int
fstring_table_probe_start(struct fstring_table_probe *probe, struct fstring_table_struct *table, VALUE hash_code)
{
RUBY_ASSERT((table->capacity & (table->capacity - 1)) == 0);
probe->mask = table->capacity - 1;
probe->idx = hash_code & probe->mask;
return probe->idx;
}
static int fstring_table_probe_next(struct fstring_table_probe *probe) {
static int
fstring_table_probe_next(struct fstring_table_probe *probe)
{
probe->idx = (probe->idx + 1) & probe->mask;
return probe->idx;
}
@ -769,22 +773,26 @@ fstring_find_or_insert(VALUE hash_code, VALUE value, struct fstr_update_arg *arg
RB_GC_GUARD(table_obj);
return value;
} else {
}
else {
// Nothing was inserted
RUBY_ATOMIC_DEC(table->count); // we didn't end up inserting
// Another thread won the race, try again at the same location
continue;
}
} else if (candidate == FSTRING_TABLE_TOMBSTONE) {
}
else if (candidate == FSTRING_TABLE_TOMBSTONE) {
// Deleted entry, continue searching
} else if (candidate == FSTRING_TABLE_MOVED) {
}
else if (candidate == FSTRING_TABLE_MOVED) {
// Wait
RB_VM_LOCK_ENTER();
RB_VM_LOCK_LEAVE();
goto retry;
} else {
}
else {
VALUE candidate_hash = RUBY_ATOMIC_VALUE_LOAD(entry->hash);
if ((candidate_hash == hash_code || candidate_hash == 0) && !fstring_cmp(candidate, value)) {
// We've found a match
@ -794,7 +802,8 @@ fstring_find_or_insert(VALUE hash_code, VALUE value, struct fstr_update_arg *arg
RUBY_ATOMIC_VALUE_CAS(entry->str, candidate, FSTRING_TABLE_TOMBSTONE);
// Fall through and continue our search
} else {
}
else {
RB_GC_GUARD(table_obj);
return candidate;
}
@ -828,7 +837,8 @@ fstring_delete(VALUE hash_code, VALUE value)
if (candidate == FSTRING_TABLE_EMPTY) {
// We didn't find our string to delete
return;
} else if (candidate == value) {
}
else if (candidate == value) {
// We found our string, replace it with a tombstone and increment the count
entry->str = FSTRING_TABLE_TOMBSTONE;
table->deleted_entries++;

View File

@ -693,7 +693,8 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
if (state == TAG_NONE) {
// This must be set AFTER doing all user-level code. At this point, the thread is effectively finished and calls to `Thread#join` will succeed.
th->value = result;
} else {
}
else {
errinfo = th->ec->errinfo;
VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
@ -1726,7 +1727,8 @@ thread_io_wake_pending_closer(struct waiting_fd *wfd)
rb_thread_t *th = rb_thread_ptr(wfd->busy->closing_thread);
if (th->scheduler != Qnil) {
rb_fiber_scheduler_unblock(th->scheduler, wfd->busy->closing_thread, wfd->busy->closing_fiber);
} else {
}
else {
rb_thread_wakeup(wfd->busy->closing_thread);
}
rb_mutex_unlock(wfd->busy->wakeup_mutex);

View File

@ -276,7 +276,8 @@ th_has_dedicated_nt(const rb_thread_t *th)
}
void
rb_add_running_thread(rb_thread_t *th){
rb_add_running_thread(rb_thread_t *th)
{
// do nothing
}

View File

@ -430,7 +430,8 @@ ASSERT_thread_sched_locked(struct rb_thread_sched *sched, rb_thread_t *th)
RBIMPL_ATTR_MAYBE_UNUSED()
static unsigned int
rb_ractor_serial(const rb_ractor_t *r) {
rb_ractor_serial(const rb_ractor_t *r)
{
if (r) {
return rb_ractor_id(r);
}

View File

@ -875,7 +875,8 @@ native_thread_native_thread_id(rb_thread_t *th)
#define USE_NATIVE_THREAD_NATIVE_THREAD_ID 1
void
rb_add_running_thread(rb_thread_t *th){
rb_add_running_thread(rb_thread_t *th)
{
// do nothing
}

View File

@ -1742,16 +1742,20 @@ pm_eval_make_iseq(VALUE src, VALUE fname, int line,
RB_GC_GUARD(name_obj);
pm_string_owned_init(scope_local, (uint8_t *) name_dup, length);
} else if (local == idMULT) {
}
else if (local == idMULT) {
forwarding |= PM_OPTIONS_SCOPE_FORWARDING_POSITIONALS;
pm_string_constant_init(scope_local, FORWARDING_POSITIONALS_STR, 1);
} else if (local == idPow) {
}
else if (local == idPow) {
forwarding |= PM_OPTIONS_SCOPE_FORWARDING_KEYWORDS;
pm_string_constant_init(scope_local, FORWARDING_KEYWORDS_STR, 1);
} else if (local == idAnd) {
}
else if (local == idAnd) {
forwarding |= PM_OPTIONS_SCOPE_FORWARDING_BLOCK;
pm_string_constant_init(scope_local, FORWARDING_BLOCK_STR, 1);
} else if (local == idDot3) {
}
else if (local == idDot3) {
forwarding |= PM_OPTIONS_SCOPE_FORWARDING_ALL;
pm_string_constant_init(scope_local, FORWARDING_ALL_STR, 1);
}

View File

@ -3228,7 +3228,8 @@ vm_callee_setup_arg(rb_execution_context_t *ec, struct rb_calling_info *calling,
vm_ci_flag(ci),
vm_ci_argc(ci),
vm_ci_kwarg(ci));
} else {
}
else {
ci = forward_cd->caller_ci;
}
can_fastpath = false;
@ -5568,7 +5569,8 @@ vm_concat_array(VALUE ary1, VALUE ary2st)
if (NIL_P(tmp2)) {
return rb_ary_push(tmp1, ary2);
} else {
}
else {
return rb_ary_concat(tmp1, tmp2);
}
}
@ -5585,7 +5587,8 @@ vm_concat_to_array(VALUE ary1, VALUE ary2st)
if (NIL_P(tmp2)) {
return rb_ary_push(ary1, ary2);
} else {
}
else {
return rb_ary_concat(ary1, tmp2);
}
}

View File

@ -361,7 +361,8 @@ vm_ci_hash_cmp(VALUE v1, VALUE v2)
return 1;
}
}
} else {
}
else {
VM_ASSERT(ci2->kwarg == NULL); // implied by matching flags
}
return 0;
@ -382,7 +383,8 @@ ci_lookup_i(st_data_t *key, st_data_t *value, st_data_t data, int existing)
if (rb_objspace_garbage_object_p((VALUE)ci)) {
*ret = (st_data_t)NULL;
return ST_DELETE;
} else {
}
else {
*ret = *key;
return ST_STOP;
}