mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Changed the each_object callback so that a pointer is passed for the object, instead of the struct.
This commit is contained in:
+2
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** gc.c - garbage collector for mruby
|
||||
** gc.h - garbage collector for mruby
|
||||
**
|
||||
** See Copyright Notice in mruby.h
|
||||
*/
|
||||
@@ -7,18 +7,10 @@
|
||||
#ifndef MRUBY_GC_H
|
||||
#define MRUBY_GC_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "mruby.h"
|
||||
#include "mruby/value.h"
|
||||
|
||||
typedef int each_object_callback(mrb_state *mrb, struct RBasic obj, void *data);
|
||||
typedef int each_object_callback(mrb_state *mrb, struct RBasic* obj, void *data);
|
||||
void mrb_objspace_each_objects(mrb_state *mrb, each_object_callback* callback, void *data);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* MRUBY_GC_H */
|
||||
|
||||
@@ -31,12 +31,12 @@ struct os_count_struct {
|
||||
size_t counts[MRB_TT_MAXDEFINE+1];
|
||||
};
|
||||
|
||||
void os_count_object_type(mrb_state *mrb, struct RBasic obj, void *data)
|
||||
void os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
|
||||
{
|
||||
struct os_count_struct* obj_count;
|
||||
obj_count = (struct os_count_struct*)(data);
|
||||
obj_count->counts[mrb_type(obj)]++;
|
||||
if (is_dead(mrb, &obj))
|
||||
obj_count->counts[obj->tt]++;
|
||||
if (is_dead(mrb, obj))
|
||||
{
|
||||
obj_count->freed++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user