Commit 2f8b0f66 authored by furunkel's avatar furunkel

Move MRB_GC_ARENA_SIZE to gc.h and fix compiler warnings

parent 5c093ed2
......@@ -65,10 +65,6 @@ struct mrb_state;
*/
typedef void* (*mrb_allocf) (struct mrb_state *mrb, void*, size_t, void *ud);
#ifndef MRB_GC_ARENA_SIZE
#define MRB_GC_ARENA_SIZE 100
#endif
#ifndef MRB_FIXED_STATE_ATEXIT_STACK_SIZE
#define MRB_FIXED_STATE_ATEXIT_STACK_SIZE 5
#endif
......
......@@ -30,6 +30,10 @@ MRB_API void mrb_free_context(struct mrb_state *mrb, struct mrb_context *c);
#define MRB_GC_WHITES (MRB_GC_WHITE_A | MRB_GC_WHITE_B)
#define MRB_GC_COLOR_MASK 7
#ifndef MRB_GC_ARENA_SIZE
#define MRB_GC_ARENA_SIZE 100
#endif
typedef enum {
GC_STATE_ROOT = 0,
GC_STATE_MARK,
......@@ -75,7 +79,7 @@ typedef struct mrb_gc {
} mrb_gc;
MRB_API mrb_bool
mrb_object_dead_p(struct mrb_state *mrb, struct RObject *object);
mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
MRB_END_DECL
......
......@@ -260,7 +260,7 @@ mrb_free(mrb_state *mrb, void *p)
}
MRB_API mrb_bool
mrb_object_dead_p(mrb_state *mrb, struct RObject *object) {
mrb_object_dead_p(mrb_state *mrb, struct RBasic *object) {
return is_dead(&mrb->gc, object);
}
......@@ -394,7 +394,7 @@ gc_protect(mrb_state *mrb, mrb_gc *gc, struct RBasic *p)
if (gc->arena_idx >= MRB_GC_ARENA_SIZE) {
/* arena overflow error */
gc->arena_idx = MRB_GC_ARENA_SIZE - 4; /* force room in arena */
mrb_raise(gc, E_RUNTIME_ERROR, "arena overflow error");
mrb_raise(mrb, E_RUNTIME_ERROR, "arena overflow error");
}
#else
if (gc->arena_idx >= gc->arena_capa) {
......
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