in v2/src/log_context_property_type_ascii_char_ptr.c [79:117]
int LOG_CONTEXT_PROPERTY_TYPE_INIT(ascii_char_ptr)(void* dst_value, const char* format, ...)
{
int result;
if (
/* Codes_SRS_LOG_CONTEXT_PROPERTY_TYPE_ASCII_CHAR_PTR_01_011: [ If dst_value is NULL, LOG_CONTEXT_PROPERTY_TYPE_INIT(ascii_char_ptr) shall fail and return a non-zero value. ]*/
(dst_value == NULL) ||
/* Codes_SRS_LOG_CONTEXT_PROPERTY_TYPE_ASCII_CHAR_PTR_01_019: [ If format is NULL, LOG_CONTEXT_PROPERTY_TYPE_INIT(ascii_char_ptr) shall fail and return a non-zero value. ]*/
(format == NULL)
)
{
(void)printf("Invalid arguments: void* dst_value=%p, const char* format=%s\r\n",
dst_value, MU_P_OR_NULL(format));
result = MU_FAILURE;
}
else
{
va_list args;
va_start(args, format);
/* Codes_SRS_LOG_CONTEXT_PROPERTY_TYPE_ASCII_CHAR_PTR_01_012: [ LOG_CONTEXT_PROPERTY_TYPE_INIT(ascii_char_ptr) shall initialize by calling snprintf the memory at dst_value with the printf style formatted string given by format and the arguments in .... ]*/
int vsprintf_result = vsprintf(dst_value, format, args);
if (vsprintf_result < 0)
{
/* Codes_SRS_LOG_CONTEXT_PROPERTY_TYPE_ASCII_CHAR_PTR_01_014: [ If formatting the string fails, LOG_CONTEXT_PROPERTY_TYPE_INIT(ascii_char_ptr) shall fail and return a non-zero value. ]*/
result = MU_FAILURE;
}
else
{
/* Codes_SRS_LOG_CONTEXT_PROPERTY_TYPE_ASCII_CHAR_PTR_01_013: [ LOG_CONTEXT_PROPERTY_TYPE_INIT(ascii_char_ptr) shall succeed and return 0. ]*/
result = 0;
}
va_end(args);
}
return result;
}