string_util.h File Reference

String utility module header file. More...

Include dependency graph for string_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

MCL_LOCAL mcl_size_t string_util_strlen (const char *buffer)
 
MCL_LOCAL mcl_size_t string_util_strnlen (const char *buffer, mcl_size_t maximum_length)
 
MCL_LOCAL void string_util_strncpy (char *destination, const char *source, mcl_size_t count)
 
MCL_LOCAL void string_util_strncat (char *destination, const char *source, mcl_size_t count)
 
MCL_LOCAL mcl_error_t string_util_strncmp (const char *string_1, const char *string_2, mcl_size_t count)
 
MCL_LOCAL mcl_error_t string_util_snprintf (char *string, mcl_size_t length, const char *format,...)
 
MCL_LOCAL mcl_bool_t string_util_memcmp (const void *block_1, const void *block_2, mcl_size_t count)
 
MCL_LOCAL void string_util_memcpy (void *destination, const void *source, mcl_size_t count)
 
MCL_LOCAL void string_util_memset (void *destination, mcl_uint8_t value, mcl_size_t count)
 
MCL_LOCAL char * string_util_strdup (const char *string)
 
MCL_LOCAL mcl_bool_t string_util_find (const char *source, const char *target, mcl_size_t *start_index)
 
MCL_LOCAL mcl_bool_t string_util_find_case_insensitive (const char *source, const char *target, mcl_size_t *start_index)
 
MCL_LOCAL long string_util_strtol (const char *source, int base, char **end_pointer)
 
MCL_LOCAL mcl_error_t string_util_reset (const void *value, char **target)
 
MCL_LOCAL mcl_error_t string_util_concatenate (const char *string_1, const char *string_2, char **result)
 

Detailed Description

String utility module header file.

Definition in file string_util.h.

Function Documentation

MCL_LOCAL mcl_error_t 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.

Parameters
[in]string_1Char array to which the string_2 will be concatenated.
[in]string_2Char array which will be concatenated to string_1.
[out]resultThe string that is result of the concatenation.
Returns

Definition at line 467 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_MALLOC, MCL_NULL, MCL_NULL_CHAR_SIZE, MCL_OK, MCL_OUT_OF_MEMORY, string_util_memcpy(), and string_util_strlen().

Referenced by _compose_access_token_request_payload(), core_processor_initialize(), and mcl_string_util_concatenate().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_bool_t 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.

Parameters
[in]sourceNull terminated string to be searched in.
[in]targetNull terminated string to be searched for.
[out]start_indexIndex of the first character of target if source contains it.
Returns
If target is found then MCL_TRUE, otherwise MCL_FALSE.

Definition at line 308 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FALSE, MCL_TRUE, and string_util_strlen().

Referenced by mcl_http_response_get_header(), and mcl_string_util_find().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_bool_t 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.

Parameters
[in]sourceNull terminated string to be searched in.
[in]targetNull terminated string to be searched for.
[out]start_indexIndex of the first character of target if source contains it.
Returns
If target is found then MCL_TRUE, otherwise MCL_FALSE.

Definition at line 357 of file string_util.c.

References LOWERCASE, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FALSE, MCL_TRUE, and string_util_strlen().

Referenced by mcl_http_response_get_header(), and mcl_string_util_find_case_insensitive().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_bool_t string_util_memcmp ( const void *  block_1,
const void *  block_2,
mcl_size_t  count 
)

Standard library memcmp wrapper.

Parameters
[in]block_1Fist memory block to compare.
[in]block_2Second memory block to compare.
[in]countSize of first memory block.
Returns

Definition at line 208 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FALSE, and MCL_TRUE.

Referenced by mcl_string_util_memcmp().

Here is the caller graph for this function:

MCL_LOCAL void string_util_memcpy ( void *  destination,
const void *  source,
mcl_size_t  count 
)

Standard library memcpy wrapper.

Parameters
[in]destinationDestination memory block.
[in]sourceSource memory block.
[in]countCount of bytes to be copied. Destination should have space for at least count bytes.

Definition at line 229 of file string_util.c.

References MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.

Referenced by _join_with_dot(), _request_payload_callback_for_put(), _response_header_callback(), _response_payload_callback(), hmac_sha256(), json_util_get_string(), mcl_core_get_last_access_token(), mcl_core_get_last_token_time(), mcl_http_client_initialize(), mcl_string_util_memcpy(), string_util_concatenate(), and string_util_strdup().

Here is the caller graph for this function:

MCL_LOCAL void string_util_memset ( void *  destination,
mcl_uint8_t  value,
mcl_size_t  count 
)

Standard library memset wrapper.

Parameters
[in]destinationDestination memory block.
[in]valueValue to be set.
[in]countCount of bytes to be set to the value. Destination should have space for at least count bytes.

Definition at line 250 of file string_util.c.

References MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.

Referenced by mcl_string_util_memset().

Here is the caller graph for this function:

MCL_LOCAL mcl_error_t string_util_reset ( const void *  value,
char **  target 
)

Initializes a new target with the given value.

Warning
The given value must be a zero-terminated C string.
Parameters
[in]valueThe content to initialize target with.
[out]targetWill point to the initialized object.
Returns

Definition at line 431 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, and string_util_strdup().

Referenced by mcl_http_request_set_parameter(), and mcl_string_util_reset().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_error_t string_util_snprintf ( char *  string,
mcl_size_t  length,
const char *  format,
  ... 
)

Standard library snprintf wrapper.

Parameters
[out]stringString to be set. Must be a zero terminated C string.
[in]lengthSpecifies how many chars should be processed.
[in]formatFormat string followed by format parameters.
Returns

Definition at line 177 of file string_util.c.

References _print_formatted_string(), MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.

Referenced by _generate_correlation_id_string(), core_processor_register(), mcl_http_request_add_header(), and random_generate_guid().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL char* string_util_strdup ( const char *  string)

Standard library strdup wrapper.

Parameters
[in]stringString to duplicate.
Returns
A duplicate of the input string.

Definition at line 274 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_MALLOC, MCL_NULL, MCL_NULL_CHAR_SIZE, string_util_memcpy(), and string_util_strlen().

Referenced by mcl_http_client_add_certificate(), mcl_http_client_initialize(), mcl_string_util_strdup(), and string_util_reset().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL void string_util_strncat ( char *  destination,
const char *  source,
mcl_size_t  count 
)

Standard library strncat wrapper.

Parameters
[out]destinationDestination string. Must be a zero terminated C string.
[in]sourceSource string. Must be a zero terminated C string.
[in]countSpecifies how many chars from source will be added at the end of destination.

Definition at line 105 of file string_util.c.

References MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.

Referenced by mcl_string_util_strncat().

Here is the caller graph for this function:

MCL_LOCAL mcl_error_t string_util_strncmp ( const char *  string_1,
const char *  string_2,
mcl_size_t  count 
)

Standard library strncmp wrapper.

Parameters
[in]string_1Fist string to be compared. Must be a zero terminated C string.
[in]string_2Second string to be compared. Must be a zero terminated C string.
[in]countSpecifies how many chars should be compared.
Returns

Definition at line 135 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, and MCL_OK.

Referenced by _check_client_secret(), _check_rsa_private_key(), core_processor_update_credentials(), and mcl_string_util_strncmp().

Here is the caller graph for this function:

MCL_LOCAL void 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.

Parameters
[out]destinationDestination string. Must be a zero terminated C string.
[in]sourceSource string. Must be a zero terminated C string.
[in]countSpecifies how many chars from source will be copied into the destination.

Definition at line 83 of file string_util.c.

References MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.

Referenced by mcl_http_response_get_header(), and mcl_string_util_strncpy().

Here is the caller graph for this function:

MCL_LOCAL mcl_size_t string_util_strnlen ( const char *  buffer,
mcl_size_t  maximum_length 
)

Standard library strnlen wrapper.

Parameters
[in]bufferBuffer which length to be calculated. Must be a zero terminated C string.
[in]maximum_lengthThe maximum length to return. If string is not zero terminated this guarantees not accessing unwanted memory.
Returns
the calculated length of buffer.

Definition at line 59 of file string_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and MCL_NULL_CHAR.

Referenced by core_configuration_validate(), and mcl_string_util_strnlen().

Here is the caller graph for this function:

MCL_LOCAL long string_util_strtol ( const char *  source,
int  base,
char **  end_pointer 
)

Returns the first occurrence of an integral value in source string.

Parameters
[in]sourceString that contains the integral value as string.
[in]baseThe base that the number will be interpreted.
[out]end_pointerThe pointer that points to the one past the last index of integral value.
Returns
If a number if found it's value is returned. Otherwise it returns 0.

Definition at line 402 of file string_util.c.

References MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.

Referenced by mcl_string_util_strtol(), and mcl_time_util_validate_timestamp().

Here is the caller graph for this function: