YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
ensure_array_size.h File Reference
#include <stdlib.h>
Include dependency graph for ensure_array_size.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ENSURE_ARRAY_SIZE(arrayp, curr_array_size, req_size)
 
#define ENSURE_BYTE_ARRAY_SIZE(arrayp, curr_array_size, req_size)
 

Functions

void yac_realloc_array (void **array, size_t elem_size, size_t *curr_array_size, size_t requested_size)
 

Macro Definition Documentation

◆ ENSURE_ARRAY_SIZE

#define ENSURE_ARRAY_SIZE ( arrayp,
curr_array_size,
req_size )
Value:
do { \
if ((size_t)(req_size) > (size_t)(curr_array_size)) \
{ \
size_t casize = (curr_array_size); \
\
yac_realloc_array((void **)&(arrayp), sizeof(*(arrayp)), &casize, \
(req_size)); \
(curr_array_size) = casize; \
} \
} \
while(0)

Definition at line 14 of file ensure_array_size.h.

◆ ENSURE_BYTE_ARRAY_SIZE

#define ENSURE_BYTE_ARRAY_SIZE ( arrayp,
curr_array_size,
req_size )
Value:
do { \
if ((size_t)(req_size) > (size_t)(curr_array_size)) \
{ \
size_t casize = (curr_array_size); \
\
yac_realloc_array(&(arrayp), 1, &casize, (req_size)); \
\
(curr_array_size) = casize; \
} \
} \
while(0)

Definition at line 27 of file ensure_array_size.h.

Function Documentation

◆ yac_realloc_array()

void yac_realloc_array ( void ** array,
size_t elem_size,
size_t * curr_array_size,
size_t requested_size )

Definition at line 12 of file ensure_array_size.c.