ruby-changes:72707
From: Nobuyoshi <ko1@a...>
Date: Wed, 27 Jul 2022 18:42:57 +0900 (JST)
Subject: [ruby-changes:72707] f42230ff22 (master): Adjust styles [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=f42230ff22 From f42230ff2210647d480d02a381065359be993015 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 27 Jul 2022 18:42:27 +0900 Subject: Adjust styles [ci skip] --- compile.c | 3 ++- debug.c | 3 ++- ext/-test-/enumerator_kw/enumerator_kw.c | 3 ++- ext/-test-/rb_call_super_kw/rb_call_super_kw.c | 3 ++- gc.c | 6 ++++-- include/ruby/fiber/scheduler.h | 12 ++++++++---- io.c | 6 ++++-- io_buffer.c | 3 ++- missing/flock.c | 8 +++++--- mjit.c | 3 ++- object.c | 12 ++++++++---- thread_pthread.c | 3 ++- vm_insnhelper.c | 3 ++- yjit.c | 3 ++- 14 files changed, 47 insertions(+), 24 deletions(-) diff --git a/compile.c b/compile.c index dc8ed45946..6a9ed2a5d0 100644 --- a/compile.c +++ b/compile.c @@ -4837,7 +4837,8 @@ struct masgn_state { https://github.com/ruby/ruby/blob/trunk/compile.c#L4837 }; static int -add_masgn_lhs_node(struct masgn_state *state, int lhs_pos, const NODE *line_node, int argc, INSN *before_insn) { +add_masgn_lhs_node(struct masgn_state *state, int lhs_pos, const NODE *line_node, int argc, INSN *before_insn) +{ if (!state) { rb_bug("no masgn_state"); } diff --git a/debug.c b/debug.c index 81b03c540f..3af7f26275 100644 --- a/debug.c +++ b/debug.c @@ -348,7 +348,8 @@ setup_debug_log_filter(void) https://github.com/ruby/ruby/blob/trunk/debug.c#L348 if (*str == '-') { debug_log.filters[i].negative = true; str++; - } else if (*str == '+') { + } + else if (*str == '+') { // negative is false on default. str++; } diff --git a/ext/-test-/enumerator_kw/enumerator_kw.c b/ext/-test-/enumerator_kw/enumerator_kw.c index 947d2b37e6..9104c51869 100644 --- a/ext/-test-/enumerator_kw/enumerator_kw.c +++ b/ext/-test-/enumerator_kw/enumerator_kw.c @@ -14,7 +14,8 @@ enumerator_kw(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/-test-/enumerator_kw/enumerator_kw.c#L14 } void -Init_enumerator_kw(void) { +Init_enumerator_kw(void) +{ VALUE module = rb_define_module("Bug"); module = rb_define_module_under(module, "EnumeratorKw"); rb_define_method(module, "m", enumerator_kw, -1); diff --git a/ext/-test-/rb_call_super_kw/rb_call_super_kw.c b/ext/-test-/rb_call_super_kw/rb_call_super_kw.c index 7f094545d2..61681ed733 100644 --- a/ext/-test-/rb_call_super_kw/rb_call_super_kw.c +++ b/ext/-test-/rb_call_super_kw/rb_call_super_kw.c @@ -7,7 +7,8 @@ rb_call_super_kw_m(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/-test-/rb_call_super_kw/rb_call_super_kw.c#L7 } void -Init_rb_call_super_kw(void) { +Init_rb_call_super_kw(void) +{ VALUE module = rb_define_module("Bug"); module = rb_define_module_under(module, "RbCallSuperKw"); rb_define_method(module, "m", rb_call_super_kw_m, -1); diff --git a/gc.c b/gc.c index 3ea05ba8e7..7dd9cdb3c7 100644 --- a/gc.c +++ b/gc.c @@ -8452,7 +8452,8 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, rb_size_pool_t *size_p https://github.com/ruby/ruby/blob/trunk/gc.c#L8452 } static bool -gc_compact_plane(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap, uintptr_t p, bits_t bitset, struct heap_page *page) { +gc_compact_plane(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap, uintptr_t p, bits_t bitset, struct heap_page *page) +{ short slot_size = page->slot_size; short slot_bits = slot_size / BASE_SLOT_SIZE; GC_ASSERT(slot_bits > 0); @@ -8511,7 +8512,8 @@ gc_compact_page(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *h https://github.com/ruby/ruby/blob/trunk/gc.c#L8512 } static bool -gc_compact_all_compacted_p(rb_objspace_t *objspace) { +gc_compact_all_compacted_p(rb_objspace_t *objspace) +{ for (int i = 0; i < SIZE_POOL_COUNT; i++) { rb_size_pool_t *size_pool = &size_pools[i]; rb_heap_t *heap = SIZE_POOL_EDEN_HEAP(size_pool); diff --git a/include/ruby/fiber/scheduler.h b/include/ruby/fiber/scheduler.h index ced092adbc..9f67bd5bf6 100644 --- a/include/ruby/fiber/scheduler.h +++ b/include/ruby/fiber/scheduler.h @@ -43,10 +43,12 @@ struct timeval; https://github.com/ruby/ruby/blob/trunk/include/ruby/fiber/scheduler.h#L43 * @return A `VALUE` which contains the result and/or errno. */ static inline VALUE -rb_fiber_scheduler_io_result(ssize_t result, int error) { +rb_fiber_scheduler_io_result(ssize_t result, int error) +{ if (result == -1) { return RB_INT2NUM(-error); - } else { + } + else { return RB_SIZE2NUM(result); } } @@ -63,11 +65,13 @@ rb_fiber_scheduler_io_result(ssize_t result, int error) { https://github.com/ruby/ruby/blob/trunk/include/ruby/fiber/scheduler.h#L65 * @return The original result of the system call. */ static inline ssize_t -rb_fiber_scheduler_io_result_apply(VALUE result) { +rb_fiber_scheduler_io_result_apply(VALUE result) +{ if (RB_FIXNUM_P(result) && RB_NUM2INT(result) < 0) { errno = -RB_NUM2INT(result); return -1; - } else { + } + else { return RB_NUM2SIZE(result); } } diff --git a/io.c b/io.c index 34ccf24977..de09a97798 100644 --- a/io.c +++ b/io.c @@ -1224,7 +1224,8 @@ io_flush_buffer(rb_io_t *fptr) https://github.com/ruby/ruby/blob/trunk/io.c#L1224 { if (!NIL_P(fptr->write_lock) && rb_mutex_owned_p(fptr->write_lock)) { return (int)io_flush_buffer_async((VALUE)fptr); - } else { + } + else { return (int)rb_mutex_synchronize(fptr->write_lock, io_flush_buffer_async, (VALUE)fptr); } } @@ -1699,7 +1700,8 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync) https://github.com/ruby/ruby/blob/trunk/io.c#L1700 else { return io_binwrite_string((VALUE)&arg); } - } else { + } + else { if (fptr->wbuf.off) { if (fptr->wbuf.len) MEMMOVE(fptr->wbuf.ptr, fptr->wbuf.ptr+fptr->wbuf.off, char, fptr->wbuf.len); diff --git a/io_buffer.c b/io_buffer.c index 898aa3e796..6ce0dd13df 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -312,7 +312,8 @@ struct io_buffer_for_yield_instance_arguments { https://github.com/ruby/ruby/blob/trunk/io_buffer.c#L312 }; static VALUE -io_buffer_for_yield_instance(VALUE _arguments) { +io_buffer_for_yield_instance(VALUE _arguments) +{ struct io_buffer_for_yield_instance_arguments *arguments = (struct io_buffer_for_yield_instance_arguments *)_arguments; rb_str_locktmp(arguments->string); diff --git a/missing/flock.c b/missing/flock.c index 9daf1c38cc..0b76961762 100644 --- a/missing/flock.c +++ b/missing/flock.c @@ -5,9 +5,11 @@ https://github.com/ruby/ruby/blob/trunk/missing/flock.c#L5 #elif defined __wasi__ #include <errno.h> -int flock(int fd, int operation) { - errno = EINVAL; - return -1; +int +flock(int fd, int operation) +{ + errno = EINVAL; + return -1; } #elif defined HAVE_FCNTL && defined HAVE_FCNTL_H diff --git a/mjit.c b/mjit.c index da3fd9d61e..01ad7339f0 100644 --- a/mjit.c +++ b/mjit.c @@ -1501,7 +1501,8 @@ create_unit(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1501 unit->id = current_unit_num++; if (iseq == NULL) { // Compact unit unit->compact_p = true; - } else { // Normal unit + } + else { // Normal unit unit->iseq = (rb_iseq_t *)iseq; ISEQ_BODY(iseq)->jit_unit = unit; } diff --git a/object.c b/object.c index 3a8a07736a..d1743b554b 100644 --- a/object.c +++ b/object.c @@ -1623,16 +1623,19 @@ rb_class_inherited_p(VALUE mod, VALUE arg) https://github.com/ruby/ruby/blob/trunk/object.c#L1623 return RCLASS_SUPERCLASSES(mod)[arg_depth] == arg ? Qtrue : Qnil; - } else if (arg_depth > mod_depth) { + } + else if (arg_depth > mod_depth) { // check if mod > arg return RCLASS_SUPERCLASSES(arg)[mod_depth] == mod ? Qfalse : Qnil; - } else { + } + else { // Depths match, and we know they aren't equal: no relation return Qnil; } - } else { + } + else { if (!CLASS_OR_MODULE_P(arg) && !RB_TYPE_P(arg, T_ICLASS)) { rb_raise(rb_eTypeError, "compared with non class/module"); } @@ -2025,7 +2028,8 @@ rb_class_superclass(VALUE klass) https://github.com/ruby/ruby/blob/trunk/object.c#L2028 if (!super) { if (klass == rb_cBasicObject) return Qnil; rb_raise(rb_eTypeError, "uninitialized class"); - } else { + } + else { super = RCLASS_SUPERCLASSES(klass)[RCLASS_SUPERCLASS_DEPTH(klass) - 1]; RUBY_ASSERT(RB_TYPE_P(klass, T_CLASS)); return super; diff --git a/thread_pthread.c b/thread_pthread.c index e748797fe7..c29c7e1958 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -146,7 +146,8 @@ rb_internal_thread_remove_event_hook(rb_internal_thread_event_hook_t * hook) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L146 if (rb_internal_thread_event_hooks == hook) { ATOMIC_PTR_EXCHANGE(rb_internal_thread_event_hooks, hook->next); success = TRUE; - } else { + } + else { rb_internal_thread_event_hook_t *h = rb_internal_thread_event_hooks; do { diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 2fb1ecb5f7..2ff48d2662 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/