add our own malloc implementation (just a mock for now)
This commit is contained in:
parent
ebffe5a22e
commit
97ba95e12f
|
@ -6,6 +6,10 @@
|
|||
typedef struct {
|
||||
} pic_state;
|
||||
|
||||
void *pic_alloc(pic_state *, size_t);
|
||||
struct pic_object *pic_gc_alloc(pic_state *, size_t, enum pic_tt);
|
||||
void pic_free(pic_state *, void *);
|
||||
|
||||
pic_state *pic_open();
|
||||
void pic_close(pic_state *);
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "picrin.h"
|
||||
|
||||
void *
|
||||
pic_alloc(pic_state *pic, size_t size)
|
||||
{
|
||||
/* mock */
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
struct pic_object *
|
||||
pic_gc_alloc(pic_state *pic, size_t size, enum pic_tt tt)
|
||||
{
|
||||
struct pic_object *obj;
|
||||
|
||||
obj = (struct pic_object *)malloc(size);
|
||||
obj->tt = tt;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
void
|
||||
pic_free(pic_state *pic, void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
Loading…
Reference in New Issue