Functions | |
void * | cpl_calloc (size_t natoms, size_t nbytes) |
Allocate memory for natoms elements of size size. | |
void | cpl_free (void *memblk) |
Memory block deallocation. | |
void * | cpl_malloc (size_t nbytes) |
Allocate nbytes bytes. | |
void | cpl_memory_dump (void) |
Display the memory status. | |
int | cpl_memory_is_empty (void) |
Tell if there is some memory allocated. | |
void * | cpl_realloc (void *memblk, size_t nbytes) |
Change the size of a memory block. | |
char * | cpl_sprintf (const char *format,...) |
Create a string and fill it in an sprintf()-like manner. | |
char * | cpl_strdup (const char *string) |
Duplicate a string. | |
char * | cpl_vsprintf (const char *format, va_list arglist) |
Create a string and fill it in an vsprintf()-like manner. |
void* cpl_calloc | ( | size_t | natoms, | |
size_t | nbytes | |||
) |
Allocate memory for natoms elements of size size.
natoms | Number of atomic elements. | |
nbytes | Element size in bytes. |
void cpl_free | ( | void * | memblk | ) |
Memory block deallocation.
void* cpl_malloc | ( | size_t | nbytes | ) |
Allocate nbytes bytes.
nbytes | Number of bytes. |
void cpl_memory_dump | ( | void | ) |
Display the memory status.
int cpl_memory_is_empty | ( | void | ) |
Tell if there is some memory allocated.
void* cpl_realloc | ( | void * | memblk, | |
size_t | nbytes | |||
) |
Change the size of a memory block.
memblk | Pointer to the memory to re-allocate. | |
nbytes | New memory block size in bytes. |
NULL
the call to cpl_realloc() is equivalent to cpl_malloc(), and if nbytes is 0 the call is equivalent to cpl_free(). Unless memblk is NULL
, it must have been returned by a previous call to cpl_malloc(), cpl_calloc(), or cpl_realloc().
char* cpl_sprintf | ( | const char * | format, | |
... | ||||
) |
Create a string and fill it in an sprintf()-like manner.
format | The format string | |
... | Variable argument list for format |
CPL_ERROR_NULL_INPUT | The format string is NULL . |
CPL_ERROR_ILLEGAL_INPUT | The format string has an invalid format. |
Example of usage:
int error; char * cp_cmd = cpl_sprintf("cp %s %s/%s", long_file, new_dir, new_file); assert( cp_cmd != NULL); error = system(cp_cmd); assert(!error); cpl_free(cp_cmd);
char* cpl_strdup | ( | const char * | string | ) |
Duplicate a string.
string | String to be duplicated. |
char* cpl_vsprintf | ( | const char * | format, | |
va_list | arglist | |||
) |
Create a string and fill it in an vsprintf()-like manner.
format | The format string | |
arglist | The argument list for the format |
CPL_ERROR_NULL_INPUT | The format string is NULL . |
CPL_ERROR_ILLEGAL_INPUT | The format string has an invalid format. |