String utility module interface header file. More...
#include "mcl_core/mcl_core_common.h"
Go to the source code of this file.
String utility module interface header file.
This module implements utility functions for basic string operations.
Definition in file mcl_string_util.h.
MCL_CORE_EXPORT mcl_error_t mcl_string_util_concatenate | ( | const char * | string_1, |
const char * | string_2, | ||
char ** | result | ||
) |
Initializes a new result
by concatenating the given string_1
and string_2.
[in] | string_1 | Char array to which the string_2 will be concatenated. |
[in] | string_2 | Char array which will be concatenated to string_1 . |
[out] | result | The string that is result of the concatenation. |
string_1
or string_2
is null. Definition at line 452 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, MCL_TRIGGERED_WITH_NULL, and string_util_concatenate().
MCL_CORE_EXPORT mcl_bool_t mcl_string_util_find | ( | const char * | source, |
const char * | target, | ||
mcl_size_t * | start_index | ||
) |
Finds the first occurence of target
in source
and puts it's first index to start_index
.
[in] | source | Null terminated string to be searched in. |
[in] | target | Null terminated string to be searched for. |
[out] | start_index | Index of the first character of target if source contains it. |
target
is found then MCL_TRUE, otherwise MCL_FALSE. Definition at line 293 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FALSE, MCL_NULL, and string_util_find().
MCL_CORE_EXPORT mcl_bool_t mcl_string_util_find_case_insensitive | ( | const char * | source, |
const char * | target, | ||
mcl_size_t * | start_index | ||
) |
Finds the first occurence of target
in source
and puts it's first index to start_index
.
[in] | source | Null terminated string to be searched in. |
[in] | target | Null terminated string to be searched for. |
[out] | start_index | Index of the first character of target if source contains it. |
target
is found then MCL_TRUE, otherwise MCL_FALSE. Definition at line 342 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FALSE, MCL_NULL, and string_util_find_case_insensitive().
Referenced by get_response().
MCL_CORE_EXPORT mcl_bool_t mcl_string_util_memcmp | ( | const void * | block_1, |
const void * | block_2, | ||
mcl_size_t | count | ||
) |
Standard library memcmp wrapper.
[in] | block_1 | Fist memory block to compare. |
[in] | block_2 | Second memory block to compare. |
[in] | count | Size of first memory block. |
Definition at line 196 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and string_util_memcmp().
MCL_CORE_EXPORT void mcl_string_util_memcpy | ( | void * | destination, |
const void * | source, | ||
mcl_size_t | count | ||
) |
Standard library memcpy wrapper.
[in] | destination | Destination memory block. |
[in] | source | Source memory block. |
[in] | count | Count of bytes to be copied. Destination should have space for at least count bytes. |
Definition at line 220 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and string_util_memcpy().
Referenced by get_response(), and start_http().
MCL_CORE_EXPORT void mcl_string_util_memset | ( | void * | destination, |
mcl_uint8_t | value, | ||
mcl_size_t | count | ||
) |
Standard library memset wrapper.
[in] | destination | Destination memory block. |
[in] | value | Value to be set. |
[in] | count | Count of bytes to be set to the value . Destination should have space for at least count bytes. |
Definition at line 238 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, and string_util_memset().
MCL_CORE_EXPORT mcl_error_t mcl_string_util_reset | ( | const void * | value, |
char ** | target | ||
) |
Initializes a new target
with the given value
.
value
must be a zero-terminated C string.[in] | value | The content to initialize target with. |
[out] | target | Will point to the initialized object. |
value
or target
is null. Definition at line 414 of file string_util.c.
References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, and string_util_reset().
Referenced by mcl_core_configuration_set_parameter().
MCL_CORE_EXPORT mcl_error_t mcl_string_util_snprintf | ( | char * | string, |
mcl_size_t | length, | ||
const char * | format, | ||
... | |||
) |
Standard library snprintf wrapper.
[out] | string | String to be set. Must be a zero terminated C string. |
[in] | length | Specifies how many chars should be processed. |
[in] | format | Format string followed by format parameters. |
Definition at line 158 of file string_util.c.
References _print_formatted_string(), MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.
Referenced by mcl_core_configuration_set_parameter(), mcl_http_client_send(), mcl_tls_socket_connect(), send_with_callback(), and start_http().
MCL_CORE_EXPORT char* mcl_string_util_strdup | ( | const char * | string | ) |
Standard library strdup wrapper.
[in] | string | String to duplicate. |
string
. Definition at line 259 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, and string_util_strdup().
MCL_CORE_EXPORT mcl_size_t mcl_string_util_strlen | ( | const char * | buffer | ) |
Standard library strlen wrapper.
[in] | buffer | Buffer which length to be calculated. Must be a zero terminated C string. |
Definition at line 23 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, and string_util_strlen().
Referenced by _decode_with_table(), mcl_core_configuration_set_parameter(), mcl_tls_ca_chain_add_certificate(), send_header(), send_header_list(), send_with_callback(), and start_http().
MCL_CORE_EXPORT void mcl_string_util_strncat | ( | char * | destination, |
const char * | source, | ||
mcl_size_t | count | ||
) |
Standard library strncat wrapper.
[out] | destination | Destination string. Must be a zero terminated C string. |
[in] | source | Source string. Must be a zero terminated C string. |
[in] | count | Specifies how many chars from source will be added at the end of destination . |
Definition at line 96 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and string_util_strncat().
MCL_CORE_EXPORT mcl_error_t mcl_string_util_strncmp | ( | const char * | string_1, |
const char * | string_2, | ||
mcl_size_t | count | ||
) |
Standard library strncmp wrapper.
[in] | string_1 | Fist string to be compared. Must be a zero terminated C string. |
[in] | string_2 | Second string to be compared. Must be a zero terminated C string. |
[in] | count | Specifies how many chars should be compared. |
string_1
or string_2
is null. Definition at line 118 of file string_util.c.
References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, and string_util_strncmp().
Referenced by mcl_http_client_send().
MCL_CORE_EXPORT void mcl_string_util_strncpy | ( | char * | destination, |
const char * | source, | ||
mcl_size_t | count | ||
) |
Standard library strncpy wrapper. Also sets the terminating null char at the end if source
is not longer than count
.
[out] | destination | Destination string. Must be a zero terminated C string. |
[in] | source | Source string. Must be a zero terminated C string. |
[in] | count | Specifies how many chars from source will be copied into the destination . |
Definition at line 74 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and string_util_strncpy().
MCL_CORE_EXPORT mcl_size_t mcl_string_util_strnlen | ( | const char * | buffer, |
mcl_size_t | maximum_length | ||
) |
Standard library strnlen wrapper.
[in] | buffer | Buffer which length to be calculated. Must be a zero terminated C string. |
[in] | maximum_length | The maximum length to return. If string is not zero terminated this guarantees not accessing unwanted memory. |
Definition at line 47 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, and string_util_strnlen().
MCL_CORE_EXPORT long mcl_string_util_strtol | ( | const char * | source, |
int | base, | ||
char ** | end_pointer | ||
) |
Returns the first occurrence of an integral value in source
string.
[in] | source | String that contains the integral value as string. |
[in] | base | The base that the number will be interpreted. |
[out] | end_pointer | The pointer that points to the one past the last index of integral value. |
Definition at line 390 of file string_util.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and string_util_strtol().