18 #define LOWERCASE(n) ((n >= 'A' && n <= 'Z') ? (n + ('a' - 'A')) : n) 41 return_value = strlen(buffer);
51 MCL_DEBUG_ENTRY(
"const char *buffer = <%p>, mcl_size_t maximum_length = <%lu>", buffer, maximum_length);
63 MCL_DEBUG_ENTRY(
"const char *buffer = <%p>, mcl_size_t maximum_length = <%lu>", buffer, maximum_length);
65 while ((count < maximum_length) && (
MCL_NULL_CHAR != buffer[count]))
76 MCL_DEBUG_ENTRY(
"char *destination = <%p>, const char *source = <%p>, mcl_size_t count = <%lu>", destination, source, count);
85 MCL_DEBUG_ENTRY(
"char *destination = <%p>, const char *source = <%p>, mcl_size_t count = <%lu>", destination, source, count);
87 #if defined(WIN32) || defined(WIN64) 88 strncpy_s(destination, count + 1, source, count);
90 strncpy(destination, source, count);
98 MCL_DEBUG_ENTRY(
"char *destination = <%p>, const char *source = <%p>, mcl_size_t count = <%lu>", destination, source, count);
107 MCL_DEBUG_ENTRY(
"char *destination = <%p>, const char *source = <%p>, mcl_size_t count = <%lu>", destination, source, count);
109 #if defined(WIN32) || defined(WIN64) 110 strncat_s(destination, strlen(destination) + count + 1, source, count);
112 strncat(destination, source, count);
122 MCL_DEBUG_ENTRY(
"const char *string_1 = <%p>, const char *string_2 = <%p>, mcl_size_t count = <%lu>", string_1, string_2, count);
140 MCL_DEBUG_ENTRY(
"const char *string_1 = <%p>, const char *string_2 = <%p>, mcl_size_t count = <%lu>", string_1, string_2, count);
142 result = strncmp(string_1, string_2, count);
163 MCL_DEBUG_ENTRY(
"char *string = <%p>, mcl_size_t length = <%lu>, const char *format = <%p>",
string, length, format);
166 va_start(args, format);
182 MCL_DEBUG_ENTRY(
"char *string = <%p>, mcl_size_t length = <%lu>, const char *format = <%p>",
string, length, format);
185 va_start(args, format);
200 MCL_DEBUG_ENTRY(
"const void *block_1 = <%p>, const void *block_2 = <%p>, mcl_size_t count = <%lu>", block_1, block_2, count);
212 MCL_DEBUG_ENTRY(
"const void *block_1 = <%p>, const void *block_2 = <%p>, mcl_size_t count = <%lu>", block_1, block_2, count);
222 MCL_DEBUG_ENTRY(
"void *destination = <%p>, const void *source = <%p>, mcl_size_t count = <%lu>", destination, source, count);
231 MCL_DEBUG_ENTRY(
"void *destination = <%p>, const void *source = <%p>, mcl_size_t count = <%lu>", destination, source, count);
233 memcpy(destination, source, count);
240 MCL_DEBUG_ENTRY(
"void *destination = <%p>, mcl_uint8_t value = <%u>, mcl_size_t count = <%lu>", destination, value, count);
252 MCL_DEBUG_ENTRY(
"void *destination = <%p>, mcl_uint8_t value = <%u>, mcl_size_t count = <%lu>", destination, value, count);
254 memset(destination, value, count);
297 MCL_DEBUG_ENTRY(
"const char *source = <%p>, const char *target = <%p>, mcl_size_t *start_index = <%p>", source, target, start_index);
315 MCL_DEBUG_ENTRY(
"const char *source = <%p>, const char *target = <%p>, mcl_size_t *start_index = <%p>", source, target, start_index);
321 if ((0 != target_length) && (target_length <= source_length))
325 for (index = 0; index < source_length; ++index)
327 state = (source[index] == target[state]) ? (state + 1) : 0;
329 if (state == target_length)
331 *start_index = index - (target_length - 1);
346 MCL_DEBUG_ENTRY(
"const char *source = <%p>, const char *target = <%p>, mcl_size_t *start_index = <%p>", source, target, start_index);
364 MCL_DEBUG_ENTRY(
"char *source = <%p>, char *target = <%p>, mcl_size_t *start_index = <%p>", source, target, start_index);
369 if ((0 != target_length) && (target_length <= source_length))
373 for (index = 0; index < source_length; ++index)
375 state = ((source[index] == target[state]) || (
LOWERCASE(source[index]) ==
LOWERCASE(target[state]))) ? (state + 1) : 0;
377 if (state == target_length)
379 *start_index = index - (target_length - 1);
394 MCL_DEBUG_ENTRY(
"const char *source = <%p>, int base = <%d>, char **end_pointer = <%p>", source, base, end_pointer);
406 MCL_DEBUG_ENTRY(
"char* source = <%p>, int base = <%p>, char *end_pointer = <%p>", source, end_pointer, base);
408 result = strtol(source, end_pointer, base);
418 MCL_DEBUG_ENTRY(
"const void *value = <%p>, char **target = <%p>", value, target);
435 MCL_DEBUG_ENTRY(
"const void *value = <%p>, char **target = <%p>", value, target);
456 MCL_DEBUG_ENTRY(
"const char *string_1 = <%p>, const char *string_2 = <%p>, char **result = <%p>", string_1, string_2, result);
473 MCL_DEBUG_ENTRY(
"const char *string_1 = <%p>, const char *string_2 = <%p>, char **result = <%p>", string_1, string_2, result);
497 MCL_DEBUG_ENTRY(
"char *string = <%p>, mcl_size_t length = <%lu>, const char *format = <%p>, va_list args = <%p>",
string, length, format, args);
499 count = vsnprintf(
string, length, format, args);
501 if ((count > 0) && (((
mcl_size_t) count) <= length))
mcl_size_t mcl_string_util_strlen(const char *buffer)
void string_util_strncat(char *destination, const char *source, mcl_size_t count)
#define MCL_FUNCTION_LEAVE_LABEL
mcl_error_t mcl_string_util_concatenate(const char *string_1, const char *string_2, char **result)
mcl_error_t mcl_string_util_snprintf(char *string, mcl_size_t length, const char *format,...)
mcl_size_t string_util_strnlen(const char *buffer, mcl_size_t maximum_length)
char * string_util_strdup(const char *string)
long string_util_strtol(const char *source, int base, char **end_pointer)
Assert module header file.
Received parameter is null.
mcl_bool_t string_util_find(const char *source, const char *target, mcl_size_t *start_index)
void string_util_memset(void *destination, mcl_uint8_t value, mcl_size_t count)
#define MCL_DEBUG_ENTRY(...)
void string_util_strncpy(char *destination, const char *source, mcl_size_t count)
mcl_error_t mcl_string_util_reset(const void *value, char **target)
mcl_bool_t string_util_find_case_insensitive(const char *source, const char *target, mcl_size_t *start_index)
String utility module header file.
void mcl_string_util_memset(void *destination, mcl_uint8_t value, mcl_size_t count)
mcl_bool_t mcl_string_util_find_case_insensitive(const char *source, const char *target, mcl_size_t *start_index)
mcl_error_t string_util_concatenate(const char *string_1, const char *string_2, char **result)
mcl_size_t mcl_string_util_strnlen(const char *buffer, mcl_size_t maximum_length)
void mcl_string_util_strncat(char *destination, const char *source, mcl_size_t count)
void string_util_memcpy(void *destination, const void *source, mcl_size_t count)
mcl_error_t mcl_string_util_strncmp(const char *string_1, const char *string_2, mcl_size_t count)
#define MCL_ASSERT_NOT_NULL(argument, return_variable)
mcl_error_t string_util_snprintf(char *string, mcl_size_t length, const char *format,...)
mcl_error_t string_util_reset(const void *value, char **target)
String utility module interface header file.
mcl_bool_t mcl_string_util_memcmp(const void *block_1, const void *block_2, mcl_size_t count)
mcl_bool_t string_util_memcmp(const void *block_1, const void *block_2, mcl_size_t count)
#define MCL_NULL_CHAR_SIZE
#define MCL_MALLOC(bytes)
char * mcl_string_util_strdup(const char *string)
mcl_error_t string_util_strncmp(const char *string_1, const char *string_2, mcl_size_t count)
void mcl_string_util_memcpy(void *destination, const void *source, mcl_size_t count)
#define MCL_DEBUG_LEAVE(...)
static mcl_error_t _print_formatted_string(char *string, mcl_size_t length, const char *format, va_list args)
mcl_size_t string_util_strlen(const char *buffer)
long mcl_string_util_strtol(const char *source, int base, char **end_pointer)
mcl_bool_t mcl_string_util_find(const char *source, const char *target, mcl_size_t *start_index)
void mcl_string_util_strncpy(char *destination, const char *source, mcl_size_t count)
Memory module interface header file.