Create Array
xip_array_<type>*
xip_array_<type>_create();
This function allocates and initializes an empty array
for holding values of type <type>. The function returns a pointer to the
created structure, or null if the structure cannot be created. The structure fields
are all initialized to zero indicating an empty array, with ownership associated
with the xip_array_<type>_*
functions.
Reserve Data Memory
xip_status
xip_array_<type>_reserve_data(
xip_array_<type>* p,
size_t max_nels
);
This function ensures that array p
has sufficient space to store up
to max_nels
elements of data. If the current
data_capacity
is insufficient and the current owner is zero,
the function attempts to allocate or reallocate space to meet the request. The
function returns XIP_STATUS_OK if the array capacity is now sufficient or
XIP_STATUS_ERROR if memory could not be allocated.
Reserve Dimension Memory
xip_status
xip_array_<type>_reserve_dim(
xip_array_<type>* p,
size_t max_nels
);
This function ensures that array p
has
sufficient space to store up to max_ndims
dimensions. If the
current dim_capacity
is insufficient and the current owner is zero,
the function attempts to allocate or reallocate space to meet the request. The
function returns XIP_STATUS_OK if the array capacity is now sufficient or
XIP_STATUS_ERROR if memory could not be allocated.
xip_array_<type>_destroy
to release memory.Destroy Array
xip_array_<type>*
xip_array_<type>_create(
xip_array_<type>* p
);
This function attempts to release all memory associated with array p. If
the owner field is zero, the function releases the memory associated with data, dim and
p, and returns null indicating success. If owner is non-zero the function returns p,
indicating failure.