summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backtrace.c3
-rw-r--r--src/class.c8
-rw-r--r--src/debug.c6
-rw-r--r--src/dump.c3
-rw-r--r--src/gc.c1
-rw-r--r--src/numeric.c3
-rw-r--r--src/proc.c1
-rw-r--r--src/state.c3
-rw-r--r--src/string.c33
-rw-r--r--src/vm.c6
10 files changed, 44 insertions, 23 deletions
diff --git a/src/backtrace.c b/src/backtrace.c
index 1d6621e2d..d634123b4 100644
--- a/src/backtrace.c
+++ b/src/backtrace.c
@@ -191,7 +191,8 @@ exc_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun
lastpc = mrb_obj_iv_get(mrb, exc, mrb_intern_lit(mrb, "lastpc"));
if (mrb_nil_p(lastpc)) {
code = NULL;
- } else {
+ }
+ else {
code = (mrb_code*)mrb_cptr(lastpc);
}
diff --git a/src/class.c b/src/class.c
index 7798ded77..7cb544b43 100644
--- a/src/class.c
+++ b/src/class.c
@@ -554,7 +554,8 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
argc = a->len;
array_argv = TRUE;
- } else {
+ }
+ else {
array_argv = FALSE;
}
@@ -951,7 +952,8 @@ include_class_new(mrb_state *mrb, struct RClass *m, struct RClass *super)
ic->super = super;
if (m->tt == MRB_TT_ICLASS) {
ic->c = m->c;
- } else {
+ }
+ else {
ic->c = m;
}
return ic;
@@ -2225,7 +2227,7 @@ mrb_mod_module_function(mrb_state *mrb, mrb_value mod)
mrb_check_type(mrb, mod, MRB_TT_MODULE);
mrb_get_args(mrb, "*", &argv, &argc);
- if(argc == 0) {
+ if (argc == 0) {
/* set MODFUNC SCOPE if implemented */
return mod;
}
diff --git a/src/debug.c b/src/debug.c
index cc2d37034..d2bcd7d5e 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -19,7 +19,8 @@ get_file(mrb_irep_debug_info *info, uint32_t pc)
if (!(pc < (*it)->start_pos)) {
ret = it + 1;
count -= step + 1;
- } else { count = step; }
+ }
+ else { count = step; }
}
--ret;
@@ -86,7 +87,8 @@ mrb_debug_get_line(mrb_irep *irep, uint32_t pc)
if (!(pc < it->start_pos)) {
ret = it + 1;
count -= step + 1;
- } else { count = step; }
+ }
+ else { count = step; }
}
--ret;
diff --git a/src/dump.c b/src/dump.c
index 45c595d3b..bb9ed8c75 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -407,7 +407,8 @@ write_lineno_record_1(mrb_state *mrb, mrb_irep *irep, uint8_t* bin)
if (irep->filename) {
filename_len = strlen(irep->filename);
- } else {
+ }
+ else {
filename_len = 0;
}
mrb_assert_int_fit(size_t, filename_len, uint16_t, UINT16_MAX);
diff --git a/src/gc.c b/src/gc.c
index 5003f4b91..ecf25d637 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -109,6 +109,7 @@ typedef struct {
struct RRange range;
struct RData data;
struct RProc proc;
+ struct REnv env;
struct RException exc;
#ifdef MRB_WORD_BOXING
struct RFloat floatv;
diff --git a/src/numeric.c b/src/numeric.c
index aa6f86cb9..2117fcc3c 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -944,7 +944,8 @@ lshift(mrb_state *mrb, mrb_int val, mrb_int width)
(val > (MRB_INT_MAX >> width))) {
goto bit_overflow;
}
- } else {
+ }
+ else {
if ((width > NUMERIC_SHIFT_WIDTH_MAX) ||
(val < (MRB_INT_MIN >> width))) {
goto bit_overflow;
diff --git a/src/proc.c b/src/proc.c
index a75774667..ab22bc1fa 100644
--- a/src/proc.c
+++ b/src/proc.c
@@ -61,6 +61,7 @@ closure_setup(mrb_state *mrb, struct RProc *p, int nlocals)
e = mrb->c->ci->env;
}
p->env = e;
+ mrb_field_write_barrier(mrb, (struct RBasic *)p, (struct RBasic *)p->env);
}
struct RProc *
diff --git a/src/state.c b/src/state.c
index 11b71dd63..2a02debef 100644
--- a/src/state.c
+++ b/src/state.c
@@ -292,7 +292,8 @@ mrb_state_atexit(mrb_state *mrb, mrb_atexit_func f)
stack_size = sizeof(mrb_atexit_func) * (mrb->atexit_stack_len + 1);
if (mrb->atexit_stack_len == 0) {
mrb->atexit_stack = (mrb_atexit_func*)mrb_malloc(mrb, stack_size);
- } else {
+ }
+ else {
mrb->atexit_stack = (mrb_atexit_func*)mrb_realloc(mrb, mrb->atexit_stack, stack_size);
}
#endif
diff --git a/src/string.c b/src/string.c
index 11abdc051..742046361 100644
--- a/src/string.c
+++ b/src/string.c
@@ -63,7 +63,8 @@ str_new(mrb_state *mrb, const char *p, size_t len)
if (p) {
memcpy(s->as.ary, p, len);
}
- } else {
+ }
+ else {
if (len >= MRB_INT_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
@@ -2029,7 +2030,8 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
if (pat_len > 0) {
end = mrb_memsearch(RSTRING_PTR(spat), pat_len, RSTRING_PTR(str)+idx, str_len - idx);
if (end < 0) break;
- } else {
+ }
+ else {
end = chars2bytes(str, idx, 1);
}
mrb_ary_push(mrb, result, byte_subseq(mrb, str, idx, end));
@@ -2852,7 +2854,8 @@ mrb_float_read(const char *string, char **endPtr)
if (*p == '-') {
sign = TRUE;
p += 1;
- } else {
+ }
+ else {
if (*p == '+') {
p += 1;
}
@@ -2888,24 +2891,28 @@ mrb_float_read(const char *string, char **endPtr)
p -= mantSize;
if (decPt < 0) {
decPt = mantSize;
- } else {
+ }
+ else {
mantSize -= 1; /* One of the digits was the point. */
}
if (mantSize > 18) {
if (decPt - 18 > 29999) {
fracExp = 29999;
- } else {
+ }
+ else {
fracExp = decPt - 18;
}
mantSize = 18;
- } else {
+ }
+ else {
fracExp = decPt - mantSize;
}
if (mantSize == 0) {
fraction = 0.0;
p = string;
goto done;
- } else {
+ }
+ else {
int frac1, frac2;
frac1 = 0;
for ( ; mantSize > 9; mantSize -= 1)
@@ -2942,7 +2949,8 @@ mrb_float_read(const char *string, char **endPtr)
if (*p == '-') {
expSign = TRUE;
p += 1;
- } else {
+ }
+ else {
if (*p == '+') {
p += 1;
}
@@ -2958,7 +2966,8 @@ mrb_float_read(const char *string, char **endPtr)
}
if (expSign) {
exp = fracExp - exp;
- } else {
+ }
+ else {
exp = fracExp + exp;
}
@@ -2972,7 +2981,8 @@ mrb_float_read(const char *string, char **endPtr)
if (exp < 0) {
expSign = TRUE;
exp = -exp;
- } else {
+ }
+ else {
expSign = FALSE;
}
if (exp > maxExponent) {
@@ -2987,7 +2997,8 @@ mrb_float_read(const char *string, char **endPtr)
}
if (expSign) {
fraction /= dblExp;
- } else {
+ }
+ else {
fraction *= dblExp;
}
diff --git a/src/vm.c b/src/vm.c
index 93b6c8564..31093ade9 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1203,7 +1203,7 @@ RETRY_TRY_BLOCK:
else {
mrb_value blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
- if(bidx >= mrb->c->ci->nregs) {
+ if (bidx >= mrb->c->ci->nregs) {
stack_extend(mrb, bidx+1, mrb->c->ci->nregs);
mrb->c->ci->nregs = bidx+1;
}
@@ -1365,7 +1365,7 @@ RETRY_TRY_BLOCK:
else {
stack_extend(mrb, irep->nregs, ci->argc+2);
}
- if(m->env) {
+ if (m->env) {
regs[0] = m->env->stack[0];
}
pc = irep->iseq;
@@ -1442,7 +1442,7 @@ RETRY_TRY_BLOCK:
}
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
- if(bidx >= ci->nregs) {
+ if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1, ci->nregs);
ci->nregs = bidx+1;
}