monado/src/xrt/auxiliary/util/u_misc.h

32 lines
656 B
C
Raw Normal View History

2019-03-18 05:52:32 +00:00
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Very small misc utils.
* @author Jakob Bornecrantz <jakob@collabora.com>
*/
#pragma once
#ifdef __cplusplus
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)))
2019-03-18 05:52:32 +00:00
#ifdef __cplusplus
}
#endif