next up previous 264
Next: astChr2Double - read a double value from a string
Up: AST Memory Management and Utility Functions
Previous: astAppendString - Append a string to another string which grows dynamically


astCalloc - Allocate and initialise memory

Description:
This function allocates memory in a similar manner to the standard C "calloc" function, but with improved security (against memory leaks, etc.) and with error reporting. It also fills the allocated memory with zeros.

Like astMalloc, it allows zero-sized memory allocation (without error), resulting in a NULL returned pointer value.

Synopsis:
void $*$astCalloc( size_t nmemb, size_t size )
Parameters:
nmemb
The number of array elements for which memory is to be allocated.
size
The size of each array element, in bytes.
Returned Value:
astCalloc()
If successful, the function returns a pointer to the start of the allocated memory region. If the size allocated is zero, this will be a NULL pointer.
Notes:
  • A pointer value of NULL is returned if this function is invoked with the global error status set or if it fails for any reason.


next up previous 264
Next: astChr2Double - read a double value from a string
Up: AST Memory Management and Utility Functions
Previous: astAppendString - Append a string to another string which grows dynamically

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 211
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council