Macros
alloc.h File Reference
#include <stdlib.h>
Include dependency graph for alloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __CCD_ALLOC_MEMORY(type, ptr_old, size)   (type *)realloc((void *)ptr_old, (size))
 
#define CCD_ALLOC(type)   __CCD_ALLOC_MEMORY(type, NULL, sizeof(type))
 
#define CCD_ALLOC_ARR(type, num_elements)   __CCD_ALLOC_MEMORY(type, NULL, sizeof(type) * (num_elements))
 
#define CCD_REALLOC_ARR(ptr, type, num_elements)   __CCD_ALLOC_MEMORY(type, ptr, sizeof(type) * (num_elements))
 

Macro Definition Documentation

◆ __CCD_ALLOC_MEMORY

#define __CCD_ALLOC_MEMORY (   type,
  ptr_old,
  size 
)    (type *)realloc((void *)ptr_old, (size))

Functions and macros required for memory allocation.

Definition at line 32 of file alloc.h.

◆ CCD_ALLOC

#define CCD_ALLOC (   type)    __CCD_ALLOC_MEMORY(type, NULL, sizeof(type))

Allocate memory for one element of type.

Definition at line 36 of file alloc.h.

◆ CCD_ALLOC_ARR

#define CCD_ALLOC_ARR (   type,
  num_elements 
)    __CCD_ALLOC_MEMORY(type, NULL, sizeof(type) * (num_elements))

Allocate memory for array of elements of type type.

Definition at line 40 of file alloc.h.

◆ CCD_REALLOC_ARR

#define CCD_REALLOC_ARR (   ptr,
  type,
  num_elements 
)    __CCD_ALLOC_MEMORY(type, ptr, sizeof(type) * (num_elements))

Definition at line 43 of file alloc.h.



fcl
Author(s):
autogenerated on Sat Sep 11 2021 02:37:42