mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00:00
aux/util: Add U_TYPED_CALLOC macro to wrap calloc and casting.
This commit is contained in:
parent
142a9a77eb
commit
e57e858351
|
@ -12,6 +12,18 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Allocate and zero the space required for some type, and cast the return type
|
||||
* appropriately.
|
||||
*/
|
||||
#define U_TYPED_CALLOC(TYPE) ((TYPE *)calloc(1, sizeof(TYPE)))
|
||||
|
||||
/*!
|
||||
* Allocate and zero the space required for some type, and cast the return type
|
||||
* appropriately.
|
||||
*/
|
||||
#define U_TYPED_ARRAY_CALLOC(TYPE, COUNT) \
|
||||
((TYPE *)calloc((COUNT), sizeof(TYPE)))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in a new issue