Commit 0f7cd2e3 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1002 from monaka/pr-extract-stack-zero-filling

Extract stack zero filling into new function.
parents 9c640a08 68468dab
......@@ -55,12 +55,20 @@ The value below allows about 60000 recursive calls in the simplest case. */
#endif
static inline void
stack_copy(mrb_value *dst, const mrb_value *src, size_t size)
stack_clear(mrb_value *from, size_t count)
{
size_t i;
const mrb_value mrb_value_zero = { { 0 } };
while(count-- > 0) {
*from++ = mrb_value_zero;
}
}
for (i = 0; i < size; i++) {
dst[i] = src[i];
static inline void
stack_copy(mrb_value *dst, const mrb_value *src, size_t size)
{
while (size-- > 0) {
*dst++ = *src++;
}
}
......@@ -130,15 +138,14 @@ stack_extend(mrb_state *mrb, int room, int keep)
}
if (room > keep) {
int i;
for (i=keep; i<room; i++) {
#ifndef MRB_NAN_BOXING
static const mrb_value mrb_value_zero = { { 0 } };
mrb->stack[i] = mrb_value_zero;
stack_clear(&(mrb->stack[keep]), room - keep);
#else
int i;
for (i=keep; i<room; i++) {
SET_NIL_VALUE(mrb->stack[i]);
#endif
}
#endif
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment