Memory module header file. More...
#include "mcl/mcl_common.h"
Go to the source code of this file.
Macros | |
#define | MCL_MALLOC(bytes) memory_allocate(bytes, __FUNCTION__, __LINE__) |
#define | MCL_NEW(p) ((p) = MCL_MALLOC((long)sizeof (*p))) |
#define | MCL_CALLOC(count, bytes) memory_allocate_with_zero(count, bytes, __FUNCTION__, __LINE__) |
#define | MCL_NEW_WITH_ZERO(p) ((p) = MCL_CALLOC(1, (long)sizeof *(p))) |
#define | MCL_RESIZE(p, bytes) ((p) = memory_reallocate(p, bytes, __FUNCTION__, __LINE__)) |
#define | MCL_FREE(p) ((void)(memory_release((p), __FUNCTION__, (mcl_uint32_t)__LINE__), (p) = MCL_NULL)) |
Functions | |
void * | memory_allocate (mcl_size_t bytes, const char *function, unsigned line) |
void * | memory_allocate_with_zero (mcl_size_t count, mcl_size_t bytes, const char *function, unsigned line) |
void * | memory_reallocate (void *p, mcl_size_t bytes, const char *function, unsigned line) |
void | memory_release (void *p, const char *function, unsigned line) |
void * | memory_malloc (mcl_size_t size) |
malloc wrapper More... | |
void * | memory_calloc (mcl_size_t count, mcl_size_t bytes) |
calloc wrapper More... | |
void * | memory_realloc (void *p, mcl_size_t bytes) |
realloc wrapper More... | |
void | memory_free (void *p) |
free wrapper More... | |
Memory module header file.
Definition in file memory.h.
#define MCL_CALLOC | ( | count, | |
bytes | |||
) | memory_allocate_with_zero(count, bytes, __FUNCTION__, __LINE__) |
Definition at line 122 of file memory.h.
Referenced by mcl_communication_get_last_access_token(), mcl_communication_get_last_token_time(), security_hash_sha256(), string_convert_binary_to_hex(), and string_replace().
#define MCL_FREE | ( | p | ) | ((void)(memory_release((p), __FUNCTION__, (mcl_uint32_t)__LINE__), (p) = MCL_NULL)) |
Definition at line 125 of file memory.h.
Referenced by _base64_encode_big_number(), _calculate_signature(), _compose_rsa_key_rotation_json(), _compose_rsa_onboarding_json(), _decode_with_table(), _destroy_data_point(), _destroy_data_source(), _destroy_value_set(), _destroy_value_set_value(), _exchange_prepare_data(), _finish_json_item(), _get_rsa_private_key(), _get_rsa_public_key(), _process_registration_response_rsa_3072(), _process_registration_response_shared_secret(), _store_add_data(), _store_list_destroy_callback(), custom_data_destroy(), data_source_configuration_destroy(), event_destroy(), event_initialize(), event_list_destroy(), event_list_initialize(), file_destroy(), hmac_sha256(), http_client_destroy(), http_client_send(), http_processor_destroy(), http_processor_get_access_token(), http_processor_update_security_information(), http_request_destroy(), http_response_destroy(), json_util_add_bool(), json_util_add_double(), json_util_add_null(), json_util_add_object(), json_util_add_string(), json_util_add_uint(), json_util_destroy(), json_util_duplicate(), json_util_get_array_item(), json_util_get_object_item(), json_util_initialize(), json_util_parse(), json_util_parse_with_size(), json_util_start_array(), json_util_start_object(), jwt_destroy(), list_destroy_with_content(), list_remove(), mcl_communication_destroy(), mcl_communication_get_last_access_token(), mcl_communication_get_last_token_time(), mcl_configuration_destroy(), mcl_data_source_configuration_get_id(), mcl_json_util_get_string(), mcl_random_generate_guid(), mcl_store_destroy(), memory_reallocate(), random_generate_array(), random_generate_guid(), security_generate_rsa_key(), security_handler_destroy(), security_rsa_get_modulus_and_exponent(), security_rsa_sign(), storage_load_rsa_registration_information(), storage_load_shared_secret_registration_information(), stream_data_destroy(), string_array_destroy(), string_array_initialize(), string_array_to_string(), string_destroy(), string_initialize(), string_initialize_dynamic(), string_initialize_new(), string_initialize_static(), string_release(), string_replace(), time_series_destroy(), and time_util_convert_to_iso_8601_format().
#define MCL_MALLOC | ( | bytes | ) | memory_allocate(bytes, __FUNCTION__, __LINE__) |
Definition at line 120 of file memory.h.
Referenced by _base64_encode_big_number(), _decode_with_table(), _encode_with_table(), _get_rsa_private_key(), _get_rsa_public_key(), _initialize(), _process_registration_response_rsa_3072(), _response_payload_callback(), hmac_sha256(), http_request_initialize(), random_generate_array(), random_generate_guid(), security_rsa_sign(), storage_load_rsa_registration_information(), storage_load_shared_secret_registration_information(), string_array_initialize(), and string_array_to_string().
#define MCL_NEW | ( | p | ) | ((p) = MCL_MALLOC((long)sizeof (*p))) |
Definition at line 121 of file memory.h.
Referenced by _exchange_add_current_data_to_request_by_streaming(), _store_add_data(), custom_data_initialize(), data_source_configuration_initialize(), event_initialize(), event_list_initialize(), file_initialize(), http_client_initialize(), http_client_send(), http_processor_initialize(), http_request_initialize(), http_response_initialize(), json_util_duplicate(), json_util_get_array_item(), json_util_get_object_item(), json_util_initialize(), json_util_parse(), json_util_parse_with_size(), jwt_initialize(), list_add(), list_initialize(), mcl_communication_initialize(), mcl_configuration_initialize(), mcl_data_source_configuration_add_data_point(), mcl_data_source_configuration_add_data_source(), mcl_store_initialize(), mcl_time_series_add_value(), mcl_time_series_new_value_set(), security_handler_initialize(), stream_data_initialize(), string_array_initialize(), string_initialize(), string_initialize_dynamic(), string_initialize_new(), string_initialize_static(), time_series_initialize(), and time_util_convert_to_iso_8601_format().
#define MCL_NEW_WITH_ZERO | ( | p | ) | ((p) = MCL_CALLOC(1, (long)sizeof *(p))) |
#define MCL_RESIZE | ( | p, | |
bytes | |||
) | ((p) = memory_reallocate(p, bytes, __FUNCTION__, __LINE__)) |
Definition at line 124 of file memory.h.
Referenced by _resize_payload_buffer_if_necessary(), _response_payload_callback(), and string_array_add().
void* memory_allocate | ( | mcl_size_t | bytes, |
const char * | function, | ||
unsigned | line | ||
) |
This function is called to allocate memory.
bytes | Size of the space to be allocated. |
function | The name of the calling function. Gathered with FUNCTION macro. |
line | The line of the calling function. Gathered with LINE macro. |
Definition at line 22 of file memory.c.
References ASSERT_MESSAGE, MCL_NULL, MCL_VERBOSE, memory_malloc(), VERBOSE_ENTRY, and VERBOSE_LEAVE.
void* memory_allocate_with_zero | ( | mcl_size_t | count, |
mcl_size_t | bytes, | ||
const char * | function, | ||
unsigned | line | ||
) |
This function is called to allocate memory and initialize it with zero.
count | Count of the object to be created. Total memory space will be (count* |
bytes | Size of the space to be allocated. |
function | The name of the calling function. Gathered with FUNCTION macro. |
line | The line of the calling function. Gathered with LINE macro. |
Definition at line 39 of file memory.c.
References ASSERT_MESSAGE, MCL_VERBOSE, memory_calloc(), VERBOSE_ENTRY, and VERBOSE_LEAVE.
void* memory_calloc | ( | mcl_size_t | count, |
mcl_size_t | bytes | ||
) |
calloc wrapper
If stddef.h is exists in the system it uses the calloc function. If another implementation will be needed it can be added.
count | Count of the object to be created. Total memory space will be (count* |
bytes | Size of the space to be allocated. |
Definition at line 109 of file memory.c.
References VERBOSE_ENTRY, and VERBOSE_LEAVE.
Referenced by http_client_initialize(), and memory_allocate_with_zero().
void memory_free | ( | void * | p | ) |
free wrapper
If stddef.h is exists in the system it uses the free function. If another implementation will be needed it can be added.
p | The pointer to be freed. |
Definition at line 129 of file memory.c.
References MCL_VERBOSE, VERBOSE_ENTRY, and VERBOSE_LEAVE.
Referenced by _libcrypto_free(), http_client_initialize(), json_util_initialize_json_library(), and memory_release().
void* memory_malloc | ( | mcl_size_t | size | ) |
malloc wrapper
If stddef.h is exists it uses the malloc function. If another implementation will be needed it can be added.
size | Size of the space to be allocated. |
Definition at line 99 of file memory.c.
References VERBOSE_ENTRY, and VERBOSE_LEAVE.
Referenced by _libcrypto_malloc(), http_client_initialize(), json_util_initialize_json_library(), and memory_allocate().
void* memory_realloc | ( | void * | p, |
mcl_size_t | bytes | ||
) |
realloc wrapper
If stddef.h is exists in the system it uses the realloc function. If another implementation will be needed it can be added.
p | The pointer to be reallocated. |
bytes | Size of the space to be allocated. |
Definition at line 119 of file memory.c.
References VERBOSE_ENTRY, and VERBOSE_LEAVE.
Referenced by _libcrypto_realloc(), http_client_initialize(), and memory_reallocate().
void* memory_reallocate | ( | void * | p, |
mcl_size_t | bytes, | ||
const char * | function, | ||
unsigned | line | ||
) |
This function is called to reallocate memory.
p | The pointer to be reallocated. |
bytes | Size of the space to be allocated. |
function | The name of the calling function. Gathered with FUNCTION macro. |
line | The line of the calling function. Gathered with LINE macro. |
Definition at line 57 of file memory.c.
References ASSERT_MESSAGE, MCL_FREE, MCL_NULL, MCL_VERBOSE, memory_realloc(), VERBOSE_ENTRY, and VERBOSE_LEAVE.
void memory_release | ( | void * | p, |
const char * | function, | ||
unsigned | line | ||
) |
This function is called to free memory.
p | The pointer to be freed. |
function | The name of the calling function. Gathered with FUNCTION macro. |
line | The line of the calling function. Gathered with LINE macro. |
Definition at line 83 of file memory.c.
References MCL_NULL, MCL_VERBOSE, memory_free(), VERBOSE_ENTRY, and VERBOSE_LEAVE.