ec_ptr_array_init

March 26, 2020 Contributors

Name

ec_ptr_array_init — Initialize an ec_ptr_array struct

Synopsis

#include "misc/ec_ptr_array.h"

| (int) **ec_ptr_array_init** ( | array, |   |
|   | prealloc_size, |   |
|   | free_func); |   |

ec_ptr_array * <var class="pdparam">array</var>;
int <var class="pdparam">prealloc_size</var>;
ec_ptr_array_free_func <var class="pdparam">free_func</var>;

Description

Initialize an ec_ptr_array struct.

Parameters

array

A pointer array. See ec_ptr_array.

prealloc_size

If this value is less than EC_PTR_ARRAY_DEFAULT_PREALLOC (16), it will be set to EC_PTR_ARRAY_DEFAULT_PREALLOC.

ec_ptr_array_free_func

Register a function used to free the elements added to the array.

Return Values

On success this function returns 1; on failure 0.

Threading

It is legal to call this function in any thread.

Note

While you can use the pointer array functions in any thread, they are not thread safe so use them with caution.

See Also

“ec_ptr_array”