add fiber assertion from #1865 patch

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-03-18 12:41:51 +09:00
parent 9201af7d36
commit 4c690b23a6
+5 -2
View File
@@ -3,6 +3,8 @@
#include "mruby/class.h"
#include "mruby/proc.h"
#define fiber_ptr(o) ((struct RFiber*)mrb_ptr(o))
#define FIBER_STACK_INIT_SIZE 64
#define FIBER_CI_INIT_SIZE 8
@@ -62,7 +64,7 @@ static mrb_value
fiber_init(mrb_state *mrb, mrb_value self)
{
static const struct mrb_context mrb_context_zero = { 0 };
struct RFiber *f = (struct RFiber*)mrb_ptr(self);
struct RFiber *f = fiber_ptr(self);
struct mrb_context *c;
struct RProc *p;
mrb_callinfo *ci;
@@ -114,8 +116,9 @@ fiber_init(mrb_state *mrb, mrb_value self)
static struct mrb_context*
fiber_check(mrb_state *mrb, mrb_value fib)
{
struct RFiber *f = (struct RFiber*)mrb_ptr(fib);
struct RFiber *f = fiber_ptr(fib);
mrb_assert(f->tt == MRB_TT_FIBER);
if (!f->cxt) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "uninitialized Fiber");
}