- ←Prev
- AST
A Library for Handling
World Coordinate Systems
in Astronomy - Next→
- TOC ↑
Description:
This
function allocates memory in which to store an array of data whose eventual size
is unknown. It should be invoked whenever a new array size is determined and
will appropriately increase the amount of memory allocated when necessary. In
general, it will over-allocate in anticipation of future growth so that the
amount of memory does not need adjusting on every invocation.
Synopsis
void
∗astGrow(
void ∗ptr,
size_t n, size_t size )
Parameters:
ptr
Pointer to previously allocated memory
(or NULL if none has yet been allocated).
n
Number of array elements to be stored
(may be zero).
size
The size of each array element.
Returned Value
astGrow()
If the memory was allocated successfully, a pointer to the start of the possibly new
memory region is returned (this may be the same as the original pointer).
Notes:
-
When new memory is allocated, the existing contents are preserved.
-
This function does not free memory once it is allocated, so the size allocated grows
to accommodate the maximum size of the array (or "
high water mark"
). Other
memory handling routines may be used to free the memory (or alter its size) if
necessary.
-
If this function is invoked with the global error status set, or if it fails for any
reason, the original pointer value is returned and the memory contents are unchanged.
Copyright (C) 2024 East Asian Observatory
- ←Prev
- AST
A Library for Handling
World
Coordinate Systems
in Astronomy - Next→
- TOC ↑