Skip to content

Commit

Permalink
Added missing vm/alloc.hpp to git.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Aug 29, 2015
1 parent 3d7d1b7 commit f1a3952
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions vm/alloc.hpp
@@ -0,0 +1,23 @@
#ifndef RBX_ALLOC_HPP
#define RBX_ALLOC_HPP

#include <stddef.h>

namespace rubinius {
#define FREE(obj) free(obj)
#define ALLOC_N(type, size) ((type*)calloc((size), sizeof(type)))
#define ALLOC(t) (t*)XMALLOC(sizeof(t))
#define REALLOC_N(v,t,n) (v)=(t*)realloc((void*)(v), sizeof(t)*n)

#define ALLOCA_N(type, size) ((type*)alloca(sizeof(type) * (size)))
#define ALLOCA(type) ((type*)alloca(sizeof(type)))
};

extern "C" {
void* XMALLOC(size_t bytes);
void XFREE(void* ptr);
void* XREALLOC(void* ptr, size_t bytes);
void* XCALLOC(size_t items, size_t bytes);
}

#endif

0 comments on commit f1a3952

Please sign in to comment.