[前][次][番号順一覧][スレッド一覧]

ruby-changes:66501

From: Nobuyoshi <ko1@a...>
Date: Thu, 17 Jun 2021 10:14:06 +0900 (JST)
Subject: [ruby-changes:66501] e4f891ce8d (master): Adjust styles [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=e4f891ce8d

From e4f891ce8d4833fea1e1f9abd69c2896d429a948 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 16 Jun 2021 22:07:05 +0900
Subject: Adjust styles [ci skip]

* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
---
 array.c                              |  6 ++++--
 compile.c                            | 10 ++++++----
 enumerator.c                         |  6 ++++--
 gc.c                                 | 24 +++++++++++++-----------
 hash.c                               |  2 +-
 include/ruby/internal/core/rbignum.h |  6 ++++--
 io.c                                 |  9 ++++++---
 memory_view.c                        |  6 ++++--
 mjit_worker.c                        |  2 +-
 object.c                             |  2 +-
 parse.y                              |  2 +-
 proc.c                               |  3 ++-
 scheduler.c                          |  3 ++-
 st.c                                 |  8 +++++---
 string.c                             |  5 +++--
 thread.c                             | 15 ++++++++++-----
 thread_sync.c                        | 10 +++++++---
 variable.c                           |  3 ++-
 vm.c                                 |  3 ++-
 vm_backtrace.c                       | 17 +++++++++++------
 vm_method.c                          |  5 +++--
 vm_trace.c                           |  2 +-
 22 files changed, 93 insertions(+), 56 deletions(-)

diff --git a/array.c b/array.c
index 83e4d18..a1e0c13 100644
--- a/array.c
+++ b/array.c
@@ -3074,11 +3074,13 @@ ary_rotate_ptr(VALUE *ptr, long len, long cnt) https://github.com/ruby/ruby/blob/trunk/array.c#L3074
         VALUE tmp = *ptr;
         memmove(ptr, ptr + 1, sizeof(VALUE)*(len - 1));
         *(ptr + len - 1) = tmp;
-    } else if (cnt == len - 1) {
+    }
+    else if (cnt == len - 1) {
         VALUE tmp = *(ptr + len - 1);
         memmove(ptr + 1, ptr, sizeof(VALUE)*(len - 1));
         *ptr = tmp;
-    } else {
+    }
+    else {
         --len;
         if (cnt < len) ary_reverse(ptr + cnt, ptr + len);
         if (--cnt > 0) ary_reverse(ptr, ptr + cnt);
diff --git a/compile.c b/compile.c
index 3139e98..c58a6c2 100644
--- a/compile.c
+++ b/compile.c
@@ -2155,7 +2155,8 @@ fix_sp_depth(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) https://github.com/ruby/ruby/blob/trunk/compile.c#L2155
 			}
 			if (lobj->sp == -1) {
 			    lobj->sp = sp;
-                        } else if (lobj->sp != sp) {
+                        }
+                        else if (lobj->sp != sp) {
                             debugs("%s:%d: sp inconsistency found but ignored (" LABEL_FORMAT " sp: %d, calculated sp: %d)\n",
                                    RSTRING_PTR(rb_iseq_path(iseq)), line,
                                    lobj->label_no, lobj->sp, sp);
@@ -4997,7 +4998,7 @@ compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, https://github.com/ruby/ruby/blob/trunk/compile.c#L4998
         struct masgn_attrasgn *memo = state.first_memo, *tmp_memo;
         while (memo) {
             VALUE topn_arg = INT2FIX((state.num_args - memo->argn) + memo->lhs_pos);
-            for(int i = 0; i < memo->num_args; i++) {
+            for (int i = 0; i < memo->num_args; i++) {
                 INSERT_BEFORE_INSN1(memo->before_insn, memo->line_node, topn, topn_arg);
             }
             tmp_memo = memo->next;
@@ -5211,7 +5212,7 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, https://github.com/ruby/ruby/blob/trunk/compile.c#L5212
 	}
 	if (explicit_receiver) {
             defined_expr0(iseq, ret, node->nd_recv, lfinish, Qfalse, true);
-            switch(nd_type(node->nd_recv)) {
+            switch (nd_type(node->nd_recv)) {
               case NODE_CALL:
               case NODE_OPCALL:
               case NODE_VCALL:
@@ -11696,7 +11697,8 @@ ibf_load_object_string(const struct ibf_load *load, const struct ibf_object_head https://github.com/ruby/ruby/blob/trunk/compile.c#L11697
     VALUE str;
     if (header->frozen && !header->internal) {
         str = rb_enc_interned_str(ptr, len, rb_enc_from_index(encindex));
-    } else {
+    }
+    else {
         str = rb_enc_str_new(ptr, len, rb_enc_from_index(encindex));
 
         if (header->internal) rb_obj_hide(str);
diff --git a/enumerator.c b/enumerator.c
index fac83b4..9c91e99 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -2701,7 +2701,8 @@ lazy_with_index_proc(VALUE proc_entry, struct MEMO* result, VALUE memos, long me https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2701
 }
 
 static VALUE
-lazy_with_index_size(VALUE proc, VALUE receiver) {
+lazy_with_index_size(VALUE proc, VALUE receiver)
+{
     return receiver;
 }
 
@@ -3144,7 +3145,8 @@ enum_chain_initialize(VALUE obj, VALUE enums) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L3145
 }
 
 static VALUE
-new_enum_chain(VALUE enums) {
+new_enum_chain(VALUE enums)
+{
     long i;
     VALUE obj = enum_chain_initialize(enum_chain_allocate(rb_cEnumChain), enums);
 
diff --git a/gc.c b/gc.c
index 8ea6f72..cdf5846 100644
--- a/gc.c
+++ b/gc.c
@@ -2289,7 +2289,7 @@ rvargc_find_contiguous_slots(int slots, RVALUE *freelist) https://github.com/ruby/ruby/blob/trunk/gc.c#L2289
     RVALUE *cursor = freelist;
     RVALUE *previous_region = NULL;
 
-    while(cursor) {
+    while (cursor) {
         int i;
         RVALUE *search = cursor;
         for (i = 0; i < (slots - 1); i++) {
@@ -3551,7 +3551,7 @@ objspace_each_objects_try(VALUE arg) https://github.com/ruby/ruby/blob/trunk/gc.c#L3551
         while (cursor_end < pend) {
             int payload_len = 0;
 
-            while(cursor_end < pend && BUILTIN_TYPE((VALUE)cursor_end) != T_PAYLOAD) {
+            while (cursor_end < pend && BUILTIN_TYPE((VALUE)cursor_end) != T_PAYLOAD) {
                 cursor_end++;
             }
 
@@ -4869,7 +4869,7 @@ lock_page_body(rb_objspace_t *objspace, struct heap_page_body *body) https://github.com/ruby/ruby/blob/trunk/gc.c#L4869
 
     if (!VirtualProtect(body, HEAP_PAGE_SIZE, PAGE_NOACCESS, &old_protect)) {
 #else
-    if(mprotect(body, HEAP_PAGE_SIZE, PROT_NONE)) {
+    if (mprotect(body, HEAP_PAGE_SIZE, PROT_NONE)) {
 #endif
         rb_bug("Couldn't protect page %p", (void *)body);
     }
@@ -4886,7 +4886,7 @@ unlock_page_body(rb_objspace_t *objspace, struct heap_page_body *body) https://github.com/ruby/ruby/blob/trunk/gc.c#L4886
 
     if (!VirtualProtect(body, HEAP_PAGE_SIZE, PAGE_READWRITE, &old_protect)) {
 #else
-    if(mprotect(body, HEAP_PAGE_SIZE, PROT_READ | PROT_WRITE)) {
+    if (mprotect(body, HEAP_PAGE_SIZE, PROT_READ | PROT_WRITE)) {
 #endif
         rb_bug("Couldn't unprotect page %p", (void *)body);
     }
@@ -4944,7 +4944,7 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page, https://github.com/ruby/ruby/blob/trunk/gc.c#L4944
      * T_NONE, it is an object that just got freed but hasn't been
      * added to the freelist yet */
 
-    while(1) {
+    while (1) {
         size_t index;
 
         bits_t *mark_bits = cursor->mark_bits;
@@ -4955,7 +4955,8 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page, https://github.com/ruby/ruby/blob/trunk/gc.c#L4955
             index = BITMAP_INDEX(heap->compact_cursor_index);
             p = heap->compact_cursor_index;
             GC_ASSERT(cursor == GET_HEAP_PAGE(p));
-        } else {
+        }
+        else {
             index = 0;
             p = cursor->start;
         }
@@ -4967,7 +4968,8 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page, https://github.com/ruby/ruby/blob/trunk/gc.c#L4968
 
         if (index == 0) {
             p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start));
-        } else {
+        }
+        else {
             p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);
         }
 
@@ -5010,7 +5012,7 @@ gc_unprotect_pages(rb_objspace_t *objspace, rb_heap_t *heap) https://github.com/ruby/ruby/blob/trunk/gc.c#L5012
 {
     struct heap_page *cursor = heap->compact_cursor;
 
-    while(cursor) {
+    while (cursor) {
         unlock_page_body(objspace, GET_PAGE_BODY(cursor->start));
         cursor = list_next(&heap->pages, cursor, page_node);
     }
@@ -5227,7 +5229,7 @@ gc_fill_swept_page_plane(rb_objspace_t *objspace, rb_heap_t *heap, intptr_t p, b https://github.com/ruby/ruby/blob/trunk/gc.c#L5229
                     /* Zombie slots don't get marked, but we can't reuse
                      * their memory until they have their finalizers run.*/
                     if (BUILTIN_TYPE(dest) != T_ZOMBIE) {
-                        if(!try_move(objspace, heap, sweep_page, dest)) {
+                        if (!try_move(objspace, heap, sweep_page, dest)) {
                             *finished_compacting = true;
                             (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
                             gc_report(5, objspace, "Quit compacting, couldn't find an object to move\n");
@@ -10059,11 +10061,11 @@ gc_compact_stats(rb_execution_context_t *ec, VALUE self) https://github.com/ruby/ruby/blob/trunk/gc.c#L10061
     VALUE moved = rb_hash_new();
 
     for (i=0; i<T_MASK; i++) {
-        if(objspace->rcompactor.considered_count_table[i]) {
+        if (objspace->rcompactor.considered_count_table[i]) {
             rb_hash_aset(considered, type_sym(i), SIZET2NUM(objspace->rcompactor.considered_count_table[i]));
         }
 
-        if(objspace->rcompactor.moved_count_table[i]) {
+        if (objspace->rcompactor.moved_count_table[i]) {
             rb_hash_aset(moved, type_sym(i), SIZET2NUM(objspace->rcompactor.moved_count_table[i]));
         }
     }
diff --git a/hash.c b/hash.c
index 88e0771..375342a 100644
--- a/hash.c
+++ b/hash.c
@@ -6510,7 +6510,7 @@ env_clone(int argc, VALUE *argv, VALUE obj) https://github.com/ruby/ruby/blob/trunk/hash.c (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]