Thanks to visit codestin.com
Credit goes to code.neomutt.org

NeoMutt  2025-12-11-189-gceedb6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
array.h File Reference

Linear Array data structure. More...

#include <stdbool.h>
#include <string.h>
#include "memory.h"
+ Include dependency graph for array.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARRAY_HEADROOM   25
 Additional number of elements to reserve, to prevent frequent reallocations.
 
#define ARRAY_HEAD(name, T)
 Define a named struct for arrays of elements of a certain type.
 
#define ARRAY_HEAD_INITIALIZER    { 0, 0, NULL }
 Static initializer for arrays.
 
#define ARRAY_INIT(head)
 Initialize an array.
 
#define ARRAY_EMPTY(head)
 Check if an array is empty.
 
#define ARRAY_SIZE(head)
 The number of elements stored.
 
#define ARRAY_CAPACITY(head)
 The number of elements the array can store without reallocation.
 
#define ARRAY_GET(head, idx)
 Return the element at index.
 
#define ARRAY_SET(head, idx, elem)
 Set an element in the array.
 
#define ARRAY_FIRST(head)
 Convenience method to get the first element.
 
#define ARRAY_LAST(head)
 Convenience method to get the last element.
 
#define ARRAY_ADD(head, elem)
 Add an element at the end of the array.
 
#define ARRAY_SHRINK(head, n)
 Mark a number of slots at the end of the array as unused.
 
#define ARRAY_ELEM_SIZE(head)
 Number of bytes occupied by an element of this array.
 
#define ARRAY_RESERVE(head, n)
 Reserve memory for the array.
 
#define ARRAY_FREE(head)
 Release all memory.
 
#define ARRAY_FOREACH(elem, head)
 Iterate over all elements of the array.
 
#define ARRAY_FOREACH_FROM(elem, head, from)
 Iterate from an index to the end.
 
#define ARRAY_FOREACH_TO(elem, head, to)
 Iterate from the beginning to an index.
 
#define ARRAY_FOREACH_FROM_TO(elem, head, from, to)
 Iterate between two indexes.
 
#define ARRAY_FOREACH_REVERSE(elem, head)
 Iterate backwards over all elements of the array.
 
#define ARRAY_FOREACH_REVERSE_FROM(elem, head, from)
 Iterate from an index to the beginning.
 
#define ARRAY_FOREACH_REVERSE_TO(elem, head, to)
 Iterate from the end to an index.
 
#define ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, from, to)
 Iterate between two indexes.
 
#define ARRAY_IDX(head, elem)
 Return the index of an element of the array.
 
#define ARRAY_INSERT(head, idx, elem)
 Insert an element into the, shifting up the subsequent entries.
 
#define ARRAY_REMOVE(head, elem)
 Remove an entry from the array, shifting down the subsequent entries.
 
#define ARRAY_SORT(head, fn, sdata)
 Sort an array.
 
#define ARRAY_SET_NORESERVE(head, idx, elem)
 
#define __coverity_escape__(x)
 
#define ARRAY_ADD_NORESERVE(head, elem)
 

Detailed Description

Linear Array data structure.

Authors
  • Pietro Cerutti
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file array.h.

Macro Definition Documentation

◆ ARRAY_HEADROOM

#define ARRAY_HEADROOM   25

Additional number of elements to reserve, to prevent frequent reallocations.

Definition at line 40 of file array.h.

◆ ARRAY_HEAD

#define ARRAY_HEAD ( name,
T )
Value:
struct name \
{ \
int size; \
int capacity; \
T *entries; \
}

Define a named struct for arrays of elements of a certain type.

Parameters
nameName of the resulting struct
TType of the elements stored in the array

Definition at line 47 of file array.h.

47#define ARRAY_HEAD(name, T) \
48 struct name \
49 { \
50 int size; \
51 int capacity; \
52 T *entries; \
53 }

◆ ARRAY_HEAD_INITIALIZER

#define ARRAY_HEAD_INITIALIZER    { 0, 0, NULL }

Static initializer for arrays.

Definition at line 58 of file array.h.

58#define ARRAY_HEAD_INITIALIZER \
59 { 0, 0, NULL }

◆ ARRAY_INIT

#define ARRAY_INIT ( head)
Value:
memset((head), 0, sizeof(*(head)))

Initialize an array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()

Definition at line 65 of file array.h.

65#define ARRAY_INIT(head) \
66 memset((head), 0, sizeof(*(head)))

◆ ARRAY_EMPTY

#define ARRAY_EMPTY ( head)
Value:
((head)->size == 0)

Check if an array is empty.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
Return values
trueThe array is empty
falseThe array is not empty

Definition at line 74 of file array.h.

74#define ARRAY_EMPTY(head) \
75 ((head)->size == 0)

◆ ARRAY_SIZE

#define ARRAY_SIZE ( head)
Value:
((head)->size)

The number of elements stored.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
Return values
numNumber of elements stored
Note
Because it is possible to add elements in the middle of the array, see ARRAY_SET(), the number returned by ARRAY_SIZE() can be larger than the number of elements actually stored. Holes are filled with zero at ARRAY_RESERVE() time and are left untouched by ARRAY_SHRINK().

Definition at line 87 of file array.h.

87#define ARRAY_SIZE(head) \
88 ((head)->size)

◆ ARRAY_CAPACITY

#define ARRAY_CAPACITY ( head)
Value:
((head)->capacity)

The number of elements the array can store without reallocation.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
Return values
numThe capacity of the array

Definition at line 95 of file array.h.

95#define ARRAY_CAPACITY(head) \
96 ((head)->capacity)

◆ ARRAY_GET

#define ARRAY_GET ( head,
idx )
Value:
((idx >= 0) && ((head)->size > (idx)) ? &(head)->entries[(idx)] : NULL)

Return the element at index.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
idxIndex, between 0 and ARRAY_SIZE()-1
Return values
ptrPointer to the element at the given index
NULLIndex was out of bounds
Note
Because it is possible to add elements in the middle of the array, it is also possible to retrieve elements that weren't previously explicitly set. In that case, the memory returned is all zeroes.

Definition at line 109 of file array.h.

109#define ARRAY_GET(head, idx) \
110 ((idx >= 0) && ((head)->size > (idx)) ? &(head)->entries[(idx)] : NULL)

◆ ARRAY_SET

#define ARRAY_SET ( head,
idx,
elem )
Value:
({ \
if ((head)->capacity <= (idx)) \
ARRAY_RESERVE(head, (idx) + 1); \
ARRAY_SET_NORESERVE(head, idx, elem); \
})

Set an element in the array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
idxIndex, between 0 and ARRAY_SIZE()-1
elemElement to copy
Return values
trueElement was inserted
falseElement was not inserted, array was full
Note
This method has the side effect of changing the array size, if the insertion happens after the last element.

Definition at line 123 of file array.h.

123#define ARRAY_SET(head, idx, elem) \
124 ({ \
125 if ((head)->capacity <= (idx)) \
126 ARRAY_RESERVE(head, (idx) + 1); \
127 ARRAY_SET_NORESERVE(head, idx, elem); \
128 })

◆ ARRAY_FIRST

#define ARRAY_FIRST ( head)
Value:
ARRAY_GET(head, 0)
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109

Convenience method to get the first element.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
Return values
ptrPointer to the first element
NULLArray is empty

Definition at line 136 of file array.h.

136#define ARRAY_FIRST(head) \
137 ARRAY_GET(head, 0)

◆ ARRAY_LAST

#define ARRAY_LAST ( head)
Value:
(ARRAY_EMPTY(head) \
? NULL \
: ARRAY_GET(head, ARRAY_SIZE(head) - 1))
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87

Convenience method to get the last element.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
Return values
ptrPointer to the last element
NULLArray is empty

Definition at line 145 of file array.h.

145#define ARRAY_LAST(head) \
146 (ARRAY_EMPTY(head) \
147 ? NULL \
148 : ARRAY_GET(head, ARRAY_SIZE(head) - 1))

◆ ARRAY_ADD

#define ARRAY_ADD ( head,
elem )
Value:
({ \
if ((head)->capacity <= (head)->size) \
ARRAY_RESERVE(head, (head)->size + 1); \
ARRAY_ADD_NORESERVE(head, elem); \
})

Add an element at the end of the array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
elemElement to copy
Return values
trueElement was added
falseElement was not added, array was full

Definition at line 157 of file array.h.

157#define ARRAY_ADD(head, elem) \
158 ({ \
159 if ((head)->capacity <= (head)->size) \
160 ARRAY_RESERVE(head, (head)->size + 1); \
161 ARRAY_ADD_NORESERVE(head, elem); \
162 })

◆ ARRAY_SHRINK

#define ARRAY_SHRINK ( head,
n )
Value:
((head)->size -= MIN(n, (head)->size))
#define MIN(a, b)
Definition memory.h:38

Mark a number of slots at the end of the array as unused.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
nNumber of slots to mark as unused
Return values
nNew size of the array
Note
This method does not do any memory management and has no effect on the capacity nor the contents of the array. It is just a resize which only works downwards.

Definition at line 174 of file array.h.

174#define ARRAY_SHRINK(head, n) \
175 ((head)->size -= MIN(n, (head)->size))

◆ ARRAY_ELEM_SIZE

#define ARRAY_ELEM_SIZE ( head)
Value:
(sizeof(*(head)->entries))

Number of bytes occupied by an element of this array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
Return values
nNumber of bytes per element

Definition at line 182 of file array.h.

182#define ARRAY_ELEM_SIZE(head) \
183 (sizeof(*(head)->entries))

◆ ARRAY_RESERVE

#define ARRAY_RESERVE ( head,
n )
Value:
({ \
if ((head)->capacity < (n)) \
{ \
mutt_mem_reallocarray(&(head)->entries, \
(n) + ARRAY_HEADROOM, \
ARRAY_ELEM_SIZE(head)); \
memset((head)->entries + (head)->capacity, 0, \
((n) + ARRAY_HEADROOM - (head)->capacity) * ARRAY_ELEM_SIZE(head)); \
(head)->capacity = (n) + ARRAY_HEADROOM; \
} \
(head)->capacity; \
})
#define ARRAY_ELEM_SIZE(head)
Number of bytes occupied by an element of this array.
Definition array.h:182
#define ARRAY_HEADROOM
Additional number of elements to reserve, to prevent frequent reallocations.
Definition array.h:40

Reserve memory for the array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
nNumber of elements to make room for
Return values
nNew capacity of the array

Definition at line 191 of file array.h.

191#define ARRAY_RESERVE(head, n) \
192 ({ \
193 if ((head)->capacity < (n)) \
194 { \
195 mutt_mem_reallocarray(&(head)->entries, \
196 (n) + ARRAY_HEADROOM, \
197 ARRAY_ELEM_SIZE(head)); \
198 memset((head)->entries + (head)->capacity, 0, \
199 ((n) + ARRAY_HEADROOM - (head)->capacity) * ARRAY_ELEM_SIZE(head)); \
200 (head)->capacity = (n) + ARRAY_HEADROOM; \
201 } \
202 (head)->capacity; \
203 })

◆ ARRAY_FREE

#define ARRAY_FREE ( head)
Value:
do \
{ \
FREE(&(head)->entries); \
(head)->size = (head)->capacity = 0; \
} while (0)

Release all memory.

Parameters
headPointer to a struct defined using ARRAY_HEAD()

Definition at line 209 of file array.h.

209#define ARRAY_FREE(head) \
210 do \
211 { \
212 FREE(&(head)->entries); \
213 (head)->size = (head)->capacity = 0; \
214 } while (0)

◆ ARRAY_FOREACH

#define ARRAY_FOREACH ( elem,
head )
Value:
ARRAY_FOREACH_FROM_TO(elem, head, 0, (head)->size)
#define ARRAY_FOREACH_FROM_TO(elem, head, from, to)
Iterate between two indexes.
Definition array.h:261

Iterate over all elements of the array.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
Note
Range: 0 .. (ARRAY_SIZE(head)-1)

Definition at line 223 of file array.h.

223#define ARRAY_FOREACH(elem, head) \
224 ARRAY_FOREACH_FROM_TO(elem, head, 0, (head)->size)

◆ ARRAY_FOREACH_FROM

#define ARRAY_FOREACH_FROM ( elem,
head,
from )
Value:
ARRAY_FOREACH_FROM_TO(elem, head, from, (head)->size)

Iterate from an index to the end.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
fromStarting index (inclusive)
Note
Range: from .. (ARRAY_SIZE(head)-1)
'from' must be between 0 and ARRAY_SIZE(head)

Definition at line 235 of file array.h.

235#define ARRAY_FOREACH_FROM(elem, head, from) \
236 ARRAY_FOREACH_FROM_TO(elem, head, from, (head)->size)

◆ ARRAY_FOREACH_TO

#define ARRAY_FOREACH_TO ( elem,
head,
to )
Value:
ARRAY_FOREACH_FROM_TO(elem, head, 0, to)

Iterate from the beginning to an index.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
toTerminating index (exclusive)
Note
Range: 0 .. (to-1)
'to' must be between 0 and ARRAY_SIZE(head)

Definition at line 247 of file array.h.

247#define ARRAY_FOREACH_TO(elem, head, to) \
248 ARRAY_FOREACH_FROM_TO(elem, head, 0, to)

◆ ARRAY_FOREACH_FROM_TO

#define ARRAY_FOREACH_FROM_TO ( elem,
head,
from,
to )
Value:
for (int ARRAY_FOREACH_IDX_##elem = (from); \
(ARRAY_FOREACH_IDX_##elem < (to)) && \
(elem = ARRAY_GET(head, ARRAY_FOREACH_IDX_##elem)); \
ARRAY_FOREACH_IDX_##elem++)

Iterate between two indexes.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
fromStarting index (inclusive)
toTerminating index (exclusive)
Note
Range: from .. (to-1)
'from' and 'to' must be between 0 and ARRAY_SIZE(head).
'from' must not be bigger than 'to'.

Definition at line 261 of file array.h.

261#define ARRAY_FOREACH_FROM_TO(elem, head, from, to) \
262 for (int ARRAY_FOREACH_IDX_##elem = (from); \
263 (ARRAY_FOREACH_IDX_##elem < (to)) && \
264 (elem = ARRAY_GET(head, ARRAY_FOREACH_IDX_##elem)); \
265 ARRAY_FOREACH_IDX_##elem++)

◆ ARRAY_FOREACH_REVERSE

#define ARRAY_FOREACH_REVERSE ( elem,
head )
Value:
ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, (head)->size, 0)
#define ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, from, to)
Iterate between two indexes.
Definition array.h:312

Iterate backwards over all elements of the array.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
Note
Range: (ARRAY_SIZE(head)-1) .. 0

Definition at line 274 of file array.h.

274#define ARRAY_FOREACH_REVERSE(elem, head) \
275 ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, (head)->size, 0)

◆ ARRAY_FOREACH_REVERSE_FROM

#define ARRAY_FOREACH_REVERSE_FROM ( elem,
head,
from )
Value:
ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, from, 0)

Iterate from an index to the beginning.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
fromStarting index (exclusive)
Note
Range: (from-1) .. 0
'from' must be between 0 and ARRAY_SIZE(head)

Definition at line 286 of file array.h.

286#define ARRAY_FOREACH_REVERSE_FROM(elem, head, from) \
287 ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, from, 0)

◆ ARRAY_FOREACH_REVERSE_TO

#define ARRAY_FOREACH_REVERSE_TO ( elem,
head,
to )
Value:
ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, (head)->size, to)

Iterate from the end to an index.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
toTerminating index (inclusive)
Note
Range: (ARRAY_SIZE(head)-1) .. to
'to' must be between 0 and ARRAY_SIZE(head)

Definition at line 298 of file array.h.

298#define ARRAY_FOREACH_REVERSE_TO(elem, head, to) \
299 ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, (head)->size, to)

◆ ARRAY_FOREACH_REVERSE_FROM_TO

#define ARRAY_FOREACH_REVERSE_FROM_TO ( elem,
head,
from,
to )
Value:
for (int ARRAY_FOREACH_IDX_##elem = (from) - 1; \
(ARRAY_FOREACH_IDX_##elem >= (to)) && \
(elem = ARRAY_GET(head, ARRAY_FOREACH_IDX_##elem)); \
ARRAY_FOREACH_IDX_##elem--)

Iterate between two indexes.

Parameters
elemVariable to be used as pointer to the element at each iteration
headPointer to a struct defined using ARRAY_HEAD()
fromStarting index (exclusive)
toTerminating index (inclusive)
Note
Range: (from-1) .. to
'from' and 'to' must be between 0 and ARRAY_SIZE(head).
'from' must not be smaller than 'to'.

Definition at line 312 of file array.h.

312#define ARRAY_FOREACH_REVERSE_FROM_TO(elem, head, from, to) \
313 for (int ARRAY_FOREACH_IDX_##elem = (from) - 1; \
314 (ARRAY_FOREACH_IDX_##elem >= (to)) && \
315 (elem = ARRAY_GET(head, ARRAY_FOREACH_IDX_##elem)); \
316 ARRAY_FOREACH_IDX_##elem--)

◆ ARRAY_IDX

#define ARRAY_IDX ( head,
elem )
Value:
(elem - (head)->entries)

Return the index of an element of the array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
elemPointer to an element of the array
Return values
nThe index of element in the array

Definition at line 324 of file array.h.

324#define ARRAY_IDX(head, elem) \
325 (elem - (head)->entries)

◆ ARRAY_INSERT

#define ARRAY_INSERT ( head,
idx,
elem )
Value:
(((head)->capacity > (head)->size \
? true \
: ARRAY_RESERVE((head), (head)->size + 1)), \
((idx) <= (head)->size \
? (memmove(&(head)->entries[(idx) + 1], &(head)->entries[(idx)], \
ARRAY_ELEM_SIZE((head)) * ((head)->size - (idx))), \
(head)->entries[(idx)] = (elem), \
(head)->size++, \
true) \
: false))
#define ARRAY_RESERVE(head, n)
Reserve memory for the array.
Definition array.h:191

Insert an element into the, shifting up the subsequent entries.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
idxIndex where the element should be inserted
elemElement to insert
Return values
trueElement was inserted
falseIndex was out of bounds (idx > ARRAY_SIZE)
Note
idx must be between 0 and ARRAY_SIZE(head) (inclusive)
To append to the end, use ARRAY_ADD() instead.

Definition at line 338 of file array.h.

338#define ARRAY_INSERT(head, idx, elem) \
339 (((head)->capacity > (head)->size \
340 ? true \
341 : ARRAY_RESERVE((head), (head)->size + 1)), \
342 ((idx) <= (head)->size \
343 ? (memmove(&(head)->entries[(idx) + 1], &(head)->entries[(idx)], \
344 ARRAY_ELEM_SIZE((head)) * ((head)->size - (idx))), \
345 (head)->entries[(idx)] = (elem), \
346 (head)->size++, \
347 true) \
348 : false))

◆ ARRAY_REMOVE

#define ARRAY_REMOVE ( head,
elem )
Value:
do \
{ \
if (ARRAY_SIZE(head) > ARRAY_IDX(head, elem) + 1) \
{ \
memmove(elem, (elem) + 1, \
ARRAY_ELEM_SIZE(head) * \
(ARRAY_SIZE(head) - ARRAY_IDX(head, elem) - 1)); \
} \
ARRAY_SHRINK(head, 1); \
} while (0)
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
Definition array.h:324

Remove an entry from the array, shifting down the subsequent entries.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
elemPointer to the element of the array to remove

Definition at line 355 of file array.h.

355#define ARRAY_REMOVE(head, elem) \
356 do \
357 { \
358 if (ARRAY_SIZE(head) > ARRAY_IDX(head, elem) + 1) \
359 { \
360 memmove(elem, (elem) + 1, \
361 ARRAY_ELEM_SIZE(head) * \
362 (ARRAY_SIZE(head) - ARRAY_IDX(head, elem) - 1)); \
363 } \
364 ARRAY_SHRINK(head, 1); \
365 } while (0)

◆ ARRAY_SORT

#define ARRAY_SORT ( head,
fn,
sdata )
Value:
({ \
if ((head)->entries != NULL) \
mutt_qsort_r((head)->entries, ARRAY_SIZE(head), ARRAY_ELEM_SIZE(head), fn, sdata);\
!!(head)->entries; \
})

Sort an array.

Parameters
headPointer to a struct defined using ARRAY_HEAD()
fnSort function, see sort_t
sdataOpaque argument to pass to sort function

Definition at line 373 of file array.h.

373#define ARRAY_SORT(head, fn, sdata) \
374 ({ \
375 if ((head)->entries != NULL) \
376 mutt_qsort_r((head)->entries, ARRAY_SIZE(head), ARRAY_ELEM_SIZE(head), fn, sdata);\
377 !!(head)->entries; \
378 })

◆ ARRAY_SET_NORESERVE

#define ARRAY_SET_NORESERVE ( head,
idx,
elem )
Value:
({ \
if ((head)->capacity > (idx)) \
{ \
(head)->size = MAX((head)->size, (idx) + 1); \
(head)->entries[(idx)] = (elem); \
} \
(head)->capacity > (idx); \
})
#define MAX(a, b)
Definition memory.h:37

Definition at line 383 of file array.h.

383#define ARRAY_SET_NORESERVE(head, idx, elem) \
384 ({ \
385 if ((head)->capacity > (idx)) \
386 { \
387 (head)->size = MAX((head)->size, (idx) + 1); \
388 (head)->entries[(idx)] = (elem); \
389 } \
390 (head)->capacity > (idx); \
391 })

◆ __coverity_escape__

#define __coverity_escape__ ( x)
Value:
0

Definition at line 394 of file array.h.

◆ ARRAY_ADD_NORESERVE

#define ARRAY_ADD_NORESERVE ( head,
elem )
Value:
((head)->capacity > (head)->size \
? (((head)->entries[(head)->size++] = (elem)), \
((void)__coverity_escape__(elem), true)) \
: ((void)__coverity_escape__(elem), false))
#define __coverity_escape__(x)
Definition array.h:394

Definition at line 396 of file array.h.

396#define ARRAY_ADD_NORESERVE(head, elem) \
397 ((head)->capacity > (head)->size \
398 ? (((head)->entries[(head)->size++] = (elem)), \
399 ((void)__coverity_escape__(elem), true)) \
400 : ((void)__coverity_escape__(elem), false))