Common Pipeline Library Reference 7.3.2
|
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. | |
This module provides the CPL memory management utilities.
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. |
The function allocates memory suitable for storage of natoms elements of size nbytes bytes. The allocated memory is cleared, i.e. the value 0 is written to each single byte.
Referenced by cpl_apertures_sort_by_flux(), cpl_apertures_sort_by_max(), cpl_apertures_sort_by_npix(), cpl_array_cast(), cpl_array_dump(), cpl_array_new(), cpl_array_wrap_cplsize(), cpl_array_wrap_double(), cpl_array_wrap_double_complex(), cpl_array_wrap_float(), cpl_array_wrap_float_complex(), cpl_array_wrap_int(), cpl_array_wrap_long(), cpl_array_wrap_long_long(), cpl_array_wrap_string(), cpl_image_fft(), cpl_imagelist_new(), cpl_mask_new(), cpl_matrix_new(), cpl_matrix_sort_columns(), cpl_matrix_sort_rows(), cpl_polynomial_extract(), cpl_ppm_match_positions(), cpl_table_and_selected_window(), cpl_table_dump(), cpl_table_new(), cpl_table_or_selected_window(), cpl_table_select_row(), cpl_wcs_platesol(), and cpl_wlcalib_slitmodel_new().
void cpl_free | ( | void * | memblk | ) |
Memory block deallocation.
Deallocates a memory block previously allocated by any of the CPL allocator functions.
Referenced by cpl_apertures_delete(), cpl_apertures_sort_by_flux(), cpl_apertures_sort_by_max(), cpl_apertures_sort_by_npix(), cpl_array_cast(), cpl_array_delete(), cpl_array_dump(), cpl_array_unwrap(), cpl_bivector_delete(), cpl_bivector_unwrap_vectors(), cpl_dfs_setup_product_header(), cpl_fit_image_gaussian(), cpl_image_cast(), cpl_image_delete(), cpl_image_divide_create(), cpl_image_fft(), cpl_image_labelise_mask_create(), cpl_image_move(), cpl_image_unwrap(), cpl_imagelist_cast(), cpl_imagelist_unwrap(), cpl_mask_delete(), cpl_mask_move(), cpl_mask_save(), cpl_mask_unwrap(), cpl_matrix_delete(), cpl_matrix_get_median(), cpl_matrix_resize(), cpl_matrix_shift(), cpl_matrix_sort_columns(), cpl_matrix_sort_rows(), cpl_matrix_unwrap(), cpl_msg_progress(), cpl_plot_bivector(), cpl_plot_bivectors(), cpl_plot_columns(), cpl_plot_image(), cpl_plot_image_col(), cpl_plot_image_row(), cpl_plot_mask(), cpl_plot_vector(), cpl_plot_vectors(), cpl_polynomial_delete(), cpl_polynomial_dump(), cpl_polynomial_extract(), cpl_polynomial_multiply(), cpl_ppm_match_positions(), cpl_propertylist_save(), cpl_stats_delete(), cpl_stats_new_from_image_window(), cpl_table_and_selected_window(), cpl_table_delete(), cpl_table_dump(), cpl_table_or_selected_window(), cpl_table_select_all(), cpl_table_select_row(), cpl_table_sort(), cpl_table_unselect_all(), cpl_table_unselect_row(), cpl_vector_cycle(), cpl_vector_delete(), cpl_vector_fit_gaussian(), cpl_vector_get_median_const(), cpl_vector_load(), cpl_vector_save(), cpl_vector_unwrap(), cpl_wcs_delete(), cpl_wcs_platesol(), and cpl_wlcalib_slitmodel_delete().
void * cpl_malloc | ( | size_t | nbytes | ) |
Allocate nbytes bytes.
nbytes | Number of bytes. |
The function allocates nbytes bytes of memory. The allocated memory is not cleared.
Referenced by cpl_apertures_sort_by_flux(), cpl_apertures_sort_by_max(), cpl_apertures_sort_by_npix(), cpl_array_dump(), cpl_bivector_duplicate(), cpl_bivector_new(), cpl_bivector_wrap_vectors(), cpl_fit_image_gaussian(), cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_saa(), cpl_image_cast(), cpl_image_divide_create(), cpl_image_duplicate(), cpl_image_labelise_mask_create(), cpl_image_move(), cpl_image_new_from_mask(), cpl_imagelist_cast(), cpl_mask_collapse_create(), cpl_mask_duplicate(), cpl_mask_move(), cpl_mask_wrap(), cpl_matrix_duplicate(), cpl_matrix_extract(), cpl_matrix_extract_diagonal(), cpl_matrix_get_determinant(), cpl_matrix_get_median(), cpl_matrix_invert_create(), cpl_matrix_new(), cpl_matrix_product_create(), cpl_matrix_shift(), cpl_matrix_solve(), cpl_matrix_sort_columns(), cpl_matrix_sort_rows(), cpl_matrix_transpose_create(), cpl_matrix_wrap(), cpl_plot_bivectors(), cpl_plot_columns(), cpl_plot_image(), cpl_plot_mask(), cpl_plot_vectors(), cpl_polynomial_dump(), cpl_polynomial_multiply(), cpl_ppm_match_positions(), cpl_stats_new_from_image_window(), cpl_table_dump(), cpl_table_duplicate(), cpl_table_sort(), cpl_table_unselect_row(), cpl_vector_cycle(), cpl_vector_fill_polynomial_fit_residual(), cpl_vector_fit_gaussian(), cpl_vector_get_median_const(), cpl_vector_load(), cpl_vector_new(), cpl_vector_wrap(), and cpl_wcs_platesol().
void cpl_memory_dump | ( | void | ) |
Display the memory status.
Referenced by cpl_test_end().
int cpl_memory_is_empty | ( | void | ) |
Tell if there is some memory allocated.
Referenced by cpl_test_end().
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. |
The function changes the size of an already allocated memory block memblk to the new size nbytes bytes. The contents is unchanged to the minimum of old and new size; newly allocated memory is not initialized. If memblk is 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().
Referenced by cpl_imagelist_set(), cpl_matrix_erase_columns(), cpl_matrix_erase_rows(), and cpl_vector_set_size().
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 |
The allocated memory is exactly what is needed to hold the string.
CPL_ERROR_NULL_INPUT | The format string is NULL . |
CPL_ERROR_ILLEGAL_INPUT | The format string has an invalid format. |
Example of usage (note how strlen() is not needed to get the string length):
References cpl_ensure, cpl_error_get_code(), CPL_ERROR_NULL_INPUT, and cpl_vsprintf().
Referenced by cpl_array_dump(), cpl_dfs_setup_product_header(), cpl_mask_save(), cpl_msg_progress(), cpl_plot_bivector(), cpl_plot_bivectors(), cpl_plot_columns(), cpl_plot_image(), cpl_plot_image_col(), cpl_plot_image_row(), cpl_plot_mask(), cpl_plot_vector(), cpl_plot_vectors(), cpl_plugin_get_version_string(), cpl_propertylist_save(), cpl_table_dump(), and cpl_vector_save().
char * cpl_strdup | ( | const char * | string | ) |
Duplicate a string.
string | String to be duplicated. |
Duplicates the input string string. The newly allocated copy returned to the caller can be deallocated using cpl_free().
Referenced by cpl_dfs_setup_product_header().
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 |
The allocated memory is exactly what is needed to hold the string.
CPL_ERROR_NULL_INPUT | The format string is NULL . |
CPL_ERROR_ILLEGAL_INPUT | The format string has an invalid format. |
References cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.
Referenced by cpl_sprintf().