new malloc macros to facilitate compiling under both c99 and c++
This commit is contained in:
parent
e215e5a1c9
commit
523766f140
1 changed files with 18 additions and 0 deletions
18
stasis/util/malloc.h
Normal file
18
stasis/util/malloc.h
Normal 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_ */
|
Loading…
Reference in a new issue