summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-02-26 13:20:43 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-02-26 13:20:43 +0900
commitef00c6da884499c8fab8531a3780e547e87c04fa (patch)
tree3a916b0415e1a3bebabb8ebc983bef3d37588ed2
parent672b81b090fb346b71f1c8e87a51a7c33f239df4 (diff)
Adjust `else` style to be consistent in each files [ci skip]
-rw-r--r--cont.c9
-rw-r--r--io.c12
-rw-r--r--io_buffer.c33
-rw-r--r--re.c12
-rw-r--r--win32/win32.c6
-rw-r--r--yjit.c3
6 files changed, 50 insertions, 25 deletions
diff --git a/cont.c b/cont.c
index a932bebf41..f06f15476e 100644
--- a/cont.c
+++ b/cont.c
@@ -2094,7 +2094,8 @@ rb_fiber_storage_get(VALUE self)
if (storage == Qnil) {
return Qnil;
- } else {
+ }
+ else {
return rb_obj_dup(storage);
}
}
@@ -2204,7 +2205,8 @@ rb_fiber_storage_aset(VALUE class, VALUE key, VALUE value)
if (value == Qnil) {
return rb_hash_delete(storage, key);
- } else {
+ }
+ else {
return rb_hash_aset(storage, key, value);
}
}
@@ -2810,7 +2812,8 @@ rb_fiber_blocking(VALUE class)
// If we are already blocking, this is essentially a no-op:
if (fiber->blocking) {
return rb_yield(fiber_value);
- } else {
+ }
+ else {
return rb_ensure(fiber_blocking_yield, fiber_value, fiber_blocking_ensure, fiber_value);
}
}
diff --git a/io.c b/io.c
index 7b5c707884..76353cb6e0 100644
--- a/io.c
+++ b/io.c
@@ -1151,7 +1151,8 @@ io_internal_wait(VALUE thread, rb_io_t *fptr, int error, int events, struct time
if (ready > 0) {
return ready;
- } else if (ready == 0) {
+ }
+ else if (ready == 0) {
errno = ETIMEDOUT;
return -1;
}
@@ -1179,7 +1180,8 @@ internal_read_func(void *ptr)
if (io_again_p(errno)) {
if (io_internal_wait(iis->th, iis->fptr, errno, RB_WAITFD_IN, iis->timeout) == -1) {
return -1;
- } else {
+ }
+ else {
goto retry;
}
}
@@ -1214,7 +1216,8 @@ internal_write_func(void *ptr)
if (io_again_p(e)) {
if (io_internal_wait(iis->th, iis->fptr, errno, RB_WAITFD_OUT, iis->timeout) == -1) {
return -1;
- } else {
+ }
+ else {
goto retry;
}
}
@@ -1243,7 +1246,8 @@ internal_writev_func(void *ptr)
if (io_again_p(errno)) {
if (io_internal_wait(iis->th, iis->fptr, errno, RB_WAITFD_OUT, iis->timeout) == -1) {
return -1;
- } else {
+ }
+ else {
goto retry;
}
}
diff --git a/io_buffer.c b/io_buffer.c
index 881929cc40..1599c54886 100644
--- a/io_buffer.c
+++ b/io_buffer.c
@@ -59,7 +59,8 @@ io_buffer_map_memory(size_t size, int flags)
int mmap_flags = MAP_ANONYMOUS;
if (flags & RB_IO_BUFFER_SHARED) {
mmap_flags |= MAP_SHARED;
- } else {
+ }
+ else {
mmap_flags |= MAP_PRIVATE;
}
@@ -1233,7 +1234,8 @@ io_buffer_slice(int argc, VALUE *argv, VALUE self)
}
length = NUM2SIZET(argv[1]);
- } else {
+ }
+ else {
length = data->size - offset;
}
@@ -1643,7 +1645,8 @@ io_buffer_size_of(VALUE klass, VALUE data_type)
total += io_buffer_data_type_size(RB_SYM2ID(RARRAY_AREF(data_type, i)));
}
return SIZET2NUM(total);
- } else {
+ }
+ else {
return SIZET2NUM(io_buffer_data_type_size(RB_SYM2ID(data_type)));
}
}
@@ -1794,21 +1797,24 @@ io_buffer_each(int argc, VALUE *argv, VALUE self)
ID data_type;
if (argc >= 1) {
data_type = RB_SYM2ID(argv[0]);
- } else {
+ }
+ else {
data_type = RB_IO_BUFFER_DATA_TYPE_U8;
}
size_t offset;
if (argc >= 2) {
offset = NUM2SIZET(argv[1]);
- } else {
+ }
+ else {
offset = 0;
}
size_t count;
if (argc >= 3) {
count = NUM2SIZET(argv[2]);
- } else {
+ }
+ else {
count = (size - offset) / io_buffer_data_type_size(data_type);
}
@@ -1844,21 +1850,24 @@ io_buffer_values(int argc, VALUE *argv, VALUE self)
ID data_type;
if (argc >= 1) {
data_type = RB_SYM2ID(argv[0]);
- } else {
+ }
+ else {
data_type = RB_IO_BUFFER_DATA_TYPE_U8;
}
size_t offset;
if (argc >= 2) {
offset = NUM2SIZET(argv[1]);
- } else {
+ }
+ else {
offset = 0;
}
size_t count;
if (argc >= 3) {
count = NUM2SIZET(argv[2]);
- } else {
+ }
+ else {
count = (size - offset) / io_buffer_data_type_size(data_type);
}
@@ -1902,14 +1911,16 @@ io_buffer_each_byte(int argc, VALUE *argv, VALUE self)
size_t offset;
if (argc >= 2) {
offset = NUM2SIZET(argv[1]);
- } else {
+ }
+ else {
offset = 0;
}
size_t count;
if (argc >= 3) {
count = NUM2SIZET(argv[2]);
- } else {
+ }
+ else {
count = (size - offset);
}
diff --git a/re.c b/re.c
index 975dee5940..2b79e8815b 100644
--- a/re.c
+++ b/re.c
@@ -2979,7 +2979,8 @@ escape_asis:
rb_str_buf_cat(buf, (char *)&c, 1);
}
break;
- } else {
+ }
+ else {
/* potential change of extended option */
int invert = 0;
int local_extend = 0;
@@ -3011,7 +3012,8 @@ escape_asis:
int local_options = options;
if (local_extend == 1) {
local_options |= ONIG_OPTION_EXTEND;
- } else {
+ }
+ else {
local_options &= ~ONIG_OPTION_EXTEND;
}
@@ -3021,7 +3023,8 @@ escape_asis:
local_options, 1);
if (ret < 0) return ret;
goto begin_scan;
- } else {
+ }
+ else {
/* change extended flag for rest of expression */
extended_mode = local_extend == 1;
goto fallthrough;
@@ -3039,7 +3042,8 @@ escape_asis:
}
}
}
- } else if (!in_char_class && recurse) {
+ }
+ else if (!in_char_class && recurse) {
parens++;
}
/* FALLTHROUGH */
diff --git a/win32/win32.c b/win32/win32.c
index ca62fe6c6d..e1741c0522 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5894,11 +5894,13 @@ winnt_stat(const WCHAR *path, struct stati128 *st, BOOL lstat)
if (e && attr_info.ReparseTag == IO_REPARSE_TAG_AF_UNIX) {
st->st_size = 0;
mode |= S_IFSOCK;
- } else if (rb_w32_reparse_symlink_p(path)) {
+ }
+ else if (rb_w32_reparse_symlink_p(path)) {
/* TODO: size in which encoding? */
st->st_size = 0;
mode |= S_IFLNK | S_IEXEC;
- } else {
+ }
+ else {
mode |= S_IFDIR | S_IEXEC;
}
}
diff --git a/yjit.c b/yjit.c
index 683e8ae366..d608ad32fa 100644
--- a/yjit.c
+++ b/yjit.c
@@ -527,7 +527,8 @@ rb_get_cme_def_type(const rb_callable_method_entry_t *cme)
{
if (UNDEFINED_METHOD_ENTRY_P(cme)) {
return VM_METHOD_TYPE_UNDEF;
- } else {
+ }
+ else {
return cme->def->type;
}
}