new malloc macros to facilitate compiling under both c99 and c++

This commit is contained in:
Rusty Sears 2012-11-14 18:34:23 -08:00
parent e215e5a1c9
commit 523766f140

18
stasis/util/malloc.h Normal file
View file

@ -0,0 +1,18 @@
/*
* malloc.h
*
* Created on: Nov 14, 2012
* Author: sears
*/
#ifndef MALLOC_H_
#define MALLOC_H_
#include <stasis/common.h>
#define stasis_malloc(cnt, typ) ((typ*)malloc((cnt)*sizeof(typ)))
#define stasis_calloc(cnt, typ) ((typ*)calloc((cnt),sizeof(typ)))
#define stasis_realloc(ptr, cnt, typ) ((typ*)realloc(ptr, (cnt)*sizeof(typ)))
#define stasis_free(ptr) free(ptr)
#endif /* MALLOC_H_ */