1iarray_allocate(3)         Library Functions Manual         iarray_allocate(3)
2
3
4

NAME

6       iarray_allocate - get pointer to nth element in iarray
7

SYNTAX

9       #include <iarray.h>
10
11       void* iarray_allocate(iarray* x, size_t pos);
12
13         iarray x;
14         size_t pos;
15         t* p = iarray_allocate(&x,pos);
16
17

DESCRIPTION

19       iarray_allocate  is similar to iarray_get, but if the requested element
20       is not in the array, the array will be resized.  If the  resize  fails,
21       iarray_allocate returns NULL and leaves the array untouched.
22
23       This function is safe to use in environments with multiple threads, but
24       it can block for indeterminate time if other threads  are  reallocating
25       the array at the same time.
26
27       Note  that  it is safe to use iarray_allocate where you would otherwise
28       use iarray_get.  The only reason to use iarray_get over iarray_allocate
29       would be optimization.
30
31

RETURN VALUE

33       Return a pointer to the requested element.  If there was a memory allo‐
34       cation failure, returns NULL.
35
36

SEE ALSO

38       iarray_init(3), iarray_get(3), iarray_free(3)
39
40
41
42                                                            iarray_allocate(3)
Impressum