mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
u/misc: Improve docs of calloc macros.
This commit is contained in:
parent
cb26f7255c
commit
9d19ab2755
|
@ -24,6 +24,14 @@ extern "C" {
|
|||
* Use instead of a bare calloc, but only when U_TYPED_CALLOC and
|
||||
* U_TYPED_ARRAY_CALLOC do not meet your needs.
|
||||
*
|
||||
* - If you are using `U_CALLOC_WITH_CAST(struct MyStruct, sizeof(MyStruct))` to
|
||||
* allocate a single structure of fixed size, you should actually use
|
||||
* `U_TYPED_CALLOC(struct MyStruct)`.
|
||||
*
|
||||
* - If you are using `U_CALLOC_WITH_CAST(struct MyStruct, sizeof(MyStruct) *
|
||||
* n)` to allocate an array, you should actually use
|
||||
* `U_TYPED_ARRAY_CALLOC(struct MyStruct, n)`.
|
||||
*
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
#define U_CALLOC_WITH_CAST(TYPE, SIZE) ((TYPE *)calloc(1, SIZE))
|
||||
|
|
Loading…
Reference in a new issue