Align styles [ci skip]

This commit is contained in:
Nobuyoshi Nakada 2025-05-15 17:48:40 +09:00
parent 427ede2dde
commit 2e3f81838c
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
9 changed files with 56 additions and 27 deletions

View File

@ -9530,7 +9530,8 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
ADD_LABEL(ret, not_basic_new_finish); ADD_LABEL(ret, not_basic_new_finish);
ADD_INSN(ret, line_node, pop); ADD_INSN(ret, line_node, pop);
} else { }
else {
ADD_SEND_R(ret, line_node, mid, argc, parent_block, INT2FIX(flag), keywords); ADD_SEND_R(ret, line_node, mid, argc, parent_block, INT2FIX(flag), keywords);
} }

3
load.c
View File

@ -1371,7 +1371,8 @@ struct rb_vm_call_cfunc2_data {
}; };
static VALUE static VALUE
call_load_ext_in_ns(VALUE data){ call_load_ext_in_ns(VALUE data)
{
struct rb_vm_call_cfunc2_data *arg = (struct rb_vm_call_cfunc2_data *)data; struct rb_vm_call_cfunc2_data *arg = (struct rb_vm_call_cfunc2_data *)data;
return rb_vm_call_cfunc2(arg->recv, load_ext, arg->arg1, arg->arg2, arg->block_handler, arg->filename); return rb_vm_call_cfunc2(arg->recv, load_ext, arg->arg1, arg->arg2, arg->block_handler, arg->filename);
} }

View File

@ -538,7 +538,8 @@ ractor_sleeping_by(const rb_ractor_t *r, rb_thread_t *th, enum rb_ractor_wait_st
if ((th->ractor_waiting.wait_status & wait_status) && th->ractor_waiting.wakeup_status == wakeup_none) { if ((th->ractor_waiting.wait_status & wait_status) && th->ractor_waiting.wakeup_status == wakeup_none) {
return th; return th;
} }
} else { }
else {
// find any thread that has this ractor wait status that is blocked // find any thread that has this ractor wait status that is blocked
ccan_list_for_each(&r->sync.wait.waiting_threads, th, ractor_waiting.waiting_node) { ccan_list_for_each(&r->sync.wait.waiting_threads, th, ractor_waiting.waiting_node) {
if ((th->ractor_waiting.wait_status & wait_status) && th->ractor_waiting.wakeup_status == wakeup_none) { if ((th->ractor_waiting.wait_status & wait_status) && th->ractor_waiting.wakeup_status == wakeup_none) {
@ -679,7 +680,8 @@ ractor_sleep_wo_gvl(void *ptr)
ractor_cond_wait(cr, cur_th); ractor_cond_wait(cr, cur_th);
cur_th->status = THREAD_RUNNABLE; cur_th->status = THREAD_RUNNABLE;
VM_ASSERT(cur_th->ractor_waiting.wakeup_status != wakeup_none); VM_ASSERT(cur_th->ractor_waiting.wakeup_status != wakeup_none);
} else { }
else {
RUBY_DEBUG_LOG("rare timing, no cond wait"); RUBY_DEBUG_LOG("rare timing, no cond wait");
} }
cur_th->ractor_waiting.wait_status = wait_none; cur_th->ractor_waiting.wait_status = wait_none;

View File

@ -985,7 +985,8 @@ onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, const
if (code >= 'a' && code <= 'z' && (flags & ONIGENC_CASE_UPCASE)) { if (code >= 'a' && code <= 'z' && (flags & ONIGENC_CASE_UPCASE)) {
flags |= ONIGENC_CASE_MODIFIED; flags |= ONIGENC_CASE_MODIFIED;
code += 'A' - 'a'; code += 'A' - 'a';
} else if (code >= 'A' && code <= 'Z' && }
else if (code >= 'A' && code <= 'Z' &&
(flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) { (flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED; flags |= ONIGENC_CASE_MODIFIED;
code += 'a' - 'A'; code += 'a' - 'A';
@ -1013,7 +1014,8 @@ onigenc_single_byte_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar
if (code >= 'a' && code <= 'z' && (flags & ONIGENC_CASE_UPCASE)) { if (code >= 'a' && code <= 'z' && (flags & ONIGENC_CASE_UPCASE)) {
flags |= ONIGENC_CASE_MODIFIED; flags |= ONIGENC_CASE_MODIFIED;
code += 'A' - 'a'; code += 'A' - 'a';
} else if (code >= 'A' && code <= 'Z' && }
else if (code >= 'A' && code <= 'Z' &&
(flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) { (flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED; flags |= ONIGENC_CASE_MODIFIED;
code += 'a' - 'A'; code += 'a' - 'A';

View File

@ -299,7 +299,8 @@ onig_error_code_to_str(UChar* s, OnigPosition code, ...)
if (q) { if (q) {
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q); len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);
xmemcpy(s, q, len); xmemcpy(s, q, len);
} else { }
else {
len = 0; len = 0;
} }
s[len] = '\0'; s[len] = '\0';

View File

@ -1174,13 +1174,15 @@ onig_region_copy(OnigRegion* to, const OnigRegion* from)
stk_base = stk_alloc;\ stk_base = stk_alloc;\
stk = stk_base;\ stk = stk_base;\
stk_end = stk_base + msa->stack_n;\ stk_end = stk_base + msa->stack_n;\
} else {\ }\
else {\
stk_alloc = (OnigStackType* )xalloca(sizeof(OnigStackType) * (stack_num));\ stk_alloc = (OnigStackType* )xalloca(sizeof(OnigStackType) * (stack_num));\
stk_base = stk_alloc;\ stk_base = stk_alloc;\
stk = stk_base;\ stk = stk_base;\
stk_end = stk_base + (stack_num);\ stk_end = stk_base + (stack_num);\
}\ }\
} else if (msa->stack_p) {\ }\
else if (msa->stack_p) {\
alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num));\ alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num));\
heap_addr = NULL;\ heap_addr = NULL;\
stk_alloc = (OnigStackType* )(msa->stack_p);\ stk_alloc = (OnigStackType* )(msa->stack_p);\
@ -1532,7 +1534,8 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
if (stk->type == STK_MATCH_CACHE_POINT) {\ if (stk->type == STK_MATCH_CACHE_POINT) {\
msa->match_cache_buf[stk->u.match_cache_point.index] |= stk->u.match_cache_point.mask;\ msa->match_cache_buf[stk->u.match_cache_point.index] |= stk->u.match_cache_point.mask;\
MATCH_CACHE_DEBUG_MEMOIZE(stk);\ MATCH_CACHE_DEBUG_MEMOIZE(stk);\
} else if (stk->type == STK_ATOMIC_MATCH_CACHE_POINT) {\ }\
else if (stk->type == STK_ATOMIC_MATCH_CACHE_POINT) {\
memoize_extended_match_cache_point(msa->match_cache_buf, stk->u.match_cache_point.index, stk->u.match_cache_point.mask);\ memoize_extended_match_cache_point(msa->match_cache_buf, stk->u.match_cache_point.index, stk->u.match_cache_point.mask);\
MATCH_CACHE_DEBUG_MEMOIZE(stkp);\ MATCH_CACHE_DEBUG_MEMOIZE(stkp);\
}\ }\
@ -2277,19 +2280,25 @@ find_cache_point(regex_t* reg, const OnigCacheOpcode* cache_opcodes, long num_ca
cache_point; cache_point;
} }
static int check_extended_match_cache_point(uint8_t *match_cache_buf, long match_cache_point_index, uint8_t match_cache_point_mask) { static int
check_extended_match_cache_point(uint8_t *match_cache_buf, long match_cache_point_index, uint8_t match_cache_point_mask)
{
if (match_cache_point_mask & 0x80) { if (match_cache_point_mask & 0x80) {
return (match_cache_buf[match_cache_point_index + 1] & 0x01) > 0; return (match_cache_buf[match_cache_point_index + 1] & 0x01) > 0;
} else { }
else {
return (match_cache_buf[match_cache_point_index] & (match_cache_point_mask << 1)) > 0; return (match_cache_buf[match_cache_point_index] & (match_cache_point_mask << 1)) > 0;
} }
} }
static void memoize_extended_match_cache_point(uint8_t *match_cache_buf, long match_cache_point_index, uint8_t match_cache_point_mask) { static void
memoize_extended_match_cache_point(uint8_t *match_cache_buf, long match_cache_point_index, uint8_t match_cache_point_mask)
{
match_cache_buf[match_cache_point_index] |= match_cache_point_mask; match_cache_buf[match_cache_point_index] |= match_cache_point_mask;
if (match_cache_point_mask & 0x80) { if (match_cache_point_mask & 0x80) {
match_cache_buf[match_cache_point_index + 1] |= 0x01; match_cache_buf[match_cache_point_index + 1] |= 0x01;
} else { }
else {
match_cache_buf[match_cache_point_index] |= match_cache_point_mask << 1; match_cache_buf[match_cache_point_index] |= match_cache_point_mask << 1;
} }
} }
@ -2630,13 +2639,16 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (check_extended_match_cache_point(msa->match_cache_buf, match_cache_point_index, match_cache_point_mask)) {\ if (check_extended_match_cache_point(msa->match_cache_buf, match_cache_point_index, match_cache_point_mask)) {\
STACK_STOP_BT_FAIL;\ STACK_STOP_BT_FAIL;\
goto fail;\ goto fail;\
} else goto fail;\ }\
} else {\ else goto fail;\
}\
else {\
if (check_extended_match_cache_point(msa->match_cache_buf, match_cache_point_index, match_cache_point_mask)) {\ if (check_extended_match_cache_point(msa->match_cache_buf, match_cache_point_index, match_cache_point_mask)) {\
p = cache_opcode->match_addr;\ p = cache_opcode->match_addr;\
MOP_OUT;\ MOP_OUT;\
JUMP;\ JUMP;\
} else goto fail;\ }\
else goto fail;\
}\ }\
}\ }\
STACK_PUSH_MATCH_CACHE_POINT(match_cache_point_index, match_cache_point_mask);\ STACK_PUSH_MATCH_CACHE_POINT(match_cache_point_index, match_cache_point_mask);\

View File

@ -5687,7 +5687,8 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
if (add_flag) { if (add_flag) {
if (is_singlebyte_range(*to, env->enc)) { if (is_singlebyte_range(*to, env->enc)) {
BITSET_SET_BIT(bs, *to); BITSET_SET_BIT(bs, *to);
} else { }
else {
r = add_code_range0(&(cc->mbuf), env, *to, *to, 0); r = add_code_range0(&(cc->mbuf), env, *to, *to, 0);
if (r < 0) return r; if (r < 0) return r;
} }
@ -5699,10 +5700,12 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
if (is_singlebyte_range(*to, env->enc)) { if (is_singlebyte_range(*to, env->enc)) {
if (IS_NCCLASS_NOT(cc)) { if (IS_NCCLASS_NOT(cc)) {
BITSET_CLEAR_BIT(bs, *to); BITSET_CLEAR_BIT(bs, *to);
} else { }
else {
BITSET_SET_BIT(bs, *to); BITSET_SET_BIT(bs, *to);
} }
} else { }
else {
if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, env->enc); if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, env->enc);
r = add_code_range0(&(cc->mbuf), env, *to, *to, 0); r = add_code_range0(&(cc->mbuf), env, *to, *to, 0);
if (r < 0) return r; if (r < 0) return r;
@ -6282,7 +6285,8 @@ is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
if (b1 != 0) { if (b1 != 0) {
if (((b1 & (b1 - 1)) == 0) && (c == not_found)) { if (((b1 & (b1 - 1)) == 0) && (c == not_found)) {
c = BITS_IN_ROOM * i + countbits(b1 - 1); c = BITS_IN_ROOM * i + countbits(b1 - 1);
} else { }
else {
return 0; /* the character class contains multiple chars */ return 0; /* the character class contains multiple chars */
} }
} }

View File

@ -1708,7 +1708,8 @@ rb_io_blocking_operations(struct rb_io *io)
} }
static void static void
rb_io_blocking_operation_enter(struct rb_io *io, struct rb_io_blocking_operation *blocking_operation) { rb_io_blocking_operation_enter(struct rb_io *io, struct rb_io_blocking_operation *blocking_operation)
{
ccan_list_add(rb_io_blocking_operations(io), &blocking_operation->list); ccan_list_add(rb_io_blocking_operations(io), &blocking_operation->list);
} }
@ -1718,7 +1719,8 @@ struct io_blocking_operation_arguments {
}; };
static VALUE static VALUE
io_blocking_operation_exit(VALUE _arguments) { io_blocking_operation_exit(VALUE _arguments)
{
struct io_blocking_operation_arguments *arguments = (void*)_arguments; struct io_blocking_operation_arguments *arguments = (void*)_arguments;
struct rb_io_blocking_operation *blocking_operation = arguments->blocking_operation; struct rb_io_blocking_operation *blocking_operation = arguments->blocking_operation;
@ -1730,7 +1732,8 @@ io_blocking_operation_exit(VALUE _arguments) {
if (thread->scheduler != Qnil) { if (thread->scheduler != Qnil) {
rb_fiber_scheduler_unblock(thread->scheduler, io->self, rb_fiberptr_self(fiber)); rb_fiber_scheduler_unblock(thread->scheduler, io->self, rb_fiberptr_self(fiber));
} else { }
else {
rb_thread_wakeup(thread->self); rb_thread_wakeup(thread->self);
} }
@ -1749,7 +1752,8 @@ rb_io_blocking_operation_exit(struct rb_io *io, struct rb_io_blocking_operation
}; };
rb_mutex_synchronize(wakeup_mutex, io_blocking_operation_exit, (VALUE)&arguments); rb_mutex_synchronize(wakeup_mutex, io_blocking_operation_exit, (VALUE)&arguments);
} else { }
else {
ccan_list_del(&blocking_operation->list); ccan_list_del(&blocking_operation->list);
} }
} }
@ -4594,7 +4598,8 @@ thread_io_wait(struct rb_io *io, int fd, int events, struct timeval *timeout)
blocking_operation.ec = GET_EC(); blocking_operation.ec = GET_EC();
rb_io_blocking_operation_enter(io, &blocking_operation); rb_io_blocking_operation_enter(io, &blocking_operation);
args.blocking_operation = &blocking_operation; args.blocking_operation = &blocking_operation;
} else { }
else {
args.io = NULL; args.io = NULL;
blocking_operation.ec = NULL; blocking_operation.ec = NULL;
args.blocking_operation = NULL; args.blocking_operation = NULL;

View File

@ -460,7 +460,8 @@ gccct_method_search(rb_execution_context_t *ec, VALUE recv, ID mid, const struct
if (NAMESPACE_USER_P(ns)) { if (NAMESPACE_USER_P(ns)) {
ns_value = ns->ns_object; ns_value = ns->ns_object;
} else { }
else {
ns_value = 0; ns_value = 0;
} }
// search global method cache // search global method cache