summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codegen.c1
-rw-r--r--src/gc.c2
-rw-r--r--src/state.c2
-rw-r--r--src/string.c3
4 files changed, 5 insertions, 3 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 82e80ee41..f37a9e331 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -2097,6 +2097,7 @@ scope_finish(codegen_scope *s, int idx)
mrb_add_irep(mrb, idx);
irep = mrb->irep[idx] = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep));
+ irep->flags = 0;
irep->idx = idx;
if (s->iseq) {
irep->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc);
diff --git a/src/gc.c b/src/gc.c
index 374072ce5..3ee5da1f8 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -325,7 +325,7 @@ struct RBasic*
mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
{
struct RBasic *p;
- static const RVALUE RVALUE_zero = { { { 0 } } };
+ static const RVALUE RVALUE_zero = { { { MRB_TT_FALSE } } };
#ifdef MRB_GC_STRESS
mrb_garbage_collect(mrb);
diff --git a/src/state.c b/src/state.c
index 8bd222fb5..db31d7037 100644
--- a/src/state.c
+++ b/src/state.c
@@ -53,7 +53,7 @@ mrb_alloca(mrb_state *mrb, size_t size)
{
struct alloca_header *p;
- p = mrb_malloc(mrb, sizeof(struct alloca_header)+size);
+ p = (struct alloca_header*) mrb_malloc(mrb, sizeof(struct alloca_header)+size);
p->next = mrb->mems;
mrb->mems = p;
return (void*)p->buf;
diff --git a/src/string.c b/src/string.c
index 760b02883..2ac4359c8 100644
--- a/src/string.c
+++ b/src/string.c
@@ -939,6 +939,7 @@ mrb_str_chomp_bang(mrb_state *mrb, mrb_value str)
else {
return mrb_nil_value();
}
+ s->ptr[s->len] = '\0';
return str;
}
@@ -970,7 +971,7 @@ mrb_str_chomp_bang(mrb_state *mrb, mrb_value str)
(rslen <= 1 ||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
s->len = len - rslen;
- p[len] = '\0';
+ p[s->len] = '\0';
return str;
}
return mrb_nil_value();