simplified us_errno_to_string()

This commit is contained in:
Maxim Devaev
2022-07-30 13:05:00 +03:00
parent 3d7fb8c8dd
commit faa1776407
4 changed files with 17 additions and 18 deletions

View File

@@ -116,9 +116,9 @@ extern pthread_mutex_t us_g_log_mutex;
}
#define US_LOG_PERROR(x_msg, ...) { \
char m_perror_buf[1024] = {0}; \
char *m_perror_ptr = us_errno_to_string(errno, m_perror_buf, 1024); \
US_LOG_ERROR(x_msg ": %s", ##__VA_ARGS__, m_perror_ptr); \
char *const m_perror_str = us_errno_to_string(errno); \
US_LOG_ERROR(x_msg ": %s", ##__VA_ARGS__, m_perror_str); \
free(m_perror_str); \
}
#define US_LOG_INFO(x_msg, ...) { \
@@ -149,9 +149,9 @@ extern pthread_mutex_t us_g_log_mutex;
#define US_LOG_VERBOSE_PERROR(x_msg, ...) { \
if (us_g_log_level >= US_LOG_LEVEL_VERBOSE) { \
char m_perror_buf[1024] = {0}; \
char *m_perror_ptr = us_errno_to_string(errno, m_perror_buf, 1023); \
US_LOG_PRINTF(US_COLOR_BLUE, "VERB ", US_COLOR_BLUE, x_msg ": %s", ##__VA_ARGS__, m_perror_ptr); \
char *m_perror_str = us_errno_to_string(errno); \
US_LOG_PRINTF(US_COLOR_BLUE, "VERB ", US_COLOR_BLUE, x_msg ": %s", ##__VA_ARGS__, m_perror_str); \
free(m_perror_str); \
} \
}