summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cont.c3
-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, 46 insertions, 23 deletions
diff --git a/cont.c b/cont.c
index 5f84eee135..68a8581c41 100644
--- a/cont.c
+++ b/cont.c
@@ -2799,7 +2799,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 0c5bbf0cb4..748192b881 100644
--- a/io.c
+++ b/io.c
@@ -1148,7 +1148,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;
}
@@ -1176,7 +1177,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;
}
}
@@ -1211,7 +1213,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;
}
}
@@ -1240,7 +1243,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 9039584025..3a6b8cc2a6 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;
}
@@ -1212,7 +1213,8 @@ io_buffer_slice(int argc, VALUE *argv, VALUE self)
}
length = NUM2SIZET(argv[1]);
- } else {
+ }
+ else {
length = data->size - offset;
}
@@ -1627,7 +1629,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)));
}
}
@@ -1778,21 +1781,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);
}
@@ -1828,21 +1834,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);
}
@@ -1886,14 +1895,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 78df8ed38a..f357d38c63 100644
--- a/re.c
+++ b/re.c
@@ -2990,7 +2990,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;
@@ -3022,7 +3023,8 @@ escape_asis:
int local_options = options;
if (local_extend == 1) {
local_options |= ONIG_OPTION_EXTEND;
- } else {
+ }
+ else {
local_options &= ~ONIG_OPTION_EXTEND;
}
@@ -3032,7 +3034,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;
@@ -3050,7 +3053,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 db0a5f5978..dcc8acfee6 100644
--- a/yjit.c
+++ b/yjit.c
@@ -522,7 +522,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;
}
}