2012-11-15 02:34:23 +00:00
|
|
|
/*
|
|
|
|
* malloc.h
|
|
|
|
*
|
|
|
|
* Created on: Nov 14, 2012
|
|
|
|
* Author: sears
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MALLOC_H_
|
|
|
|
#define MALLOC_H_
|
|
|
|
|
|
|
|
#include <stasis/common.h>
|
|
|
|
|
2013-02-13 21:27:51 +00:00
|
|
|
#define stasis_alloca(cnt, typ) ((typ*)alloca((cnt)*sizeof(typ)))
|
2012-11-15 07:04:03 +00:00
|
|
|
#define stasis_alloc(typ) ((typ*)malloc(sizeof(typ)))
|
2012-11-15 02:34:23 +00:00
|
|
|
#define stasis_malloc(cnt, typ) ((typ*)malloc((cnt)*sizeof(typ)))
|
2012-11-15 07:04:03 +00:00
|
|
|
#define stasis_malloc_trailing_array(typ, array_sz) ((typ*)malloc(sizeof(typ)+(array_sz)))
|
2012-11-15 02:34:23 +00:00
|
|
|
#define stasis_calloc(cnt, typ) ((typ*)calloc((cnt),sizeof(typ)))
|
2012-12-01 02:29:28 +00:00
|
|
|
#define stasis_calloc_trailing_array(typ, array_sz) ((typ*)calloc(sizeof(typ)+(array_sz),1))
|
2012-11-15 02:34:23 +00:00
|
|
|
#define stasis_realloc(ptr, cnt, typ) ((typ*)realloc(ptr, (cnt)*sizeof(typ)))
|
|
|
|
#define stasis_free(ptr) free(ptr)
|
|
|
|
|
|
|
|
#endif /* MALLOC_H_ */
|