From 71f1d397bfb7e9b07bfcc47ef9e1c5ed608b8848 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Thu, 1 Apr 2021 08:49:18 +0300 Subject: [PATCH] moved errno_to_string() to the tools --- src/libs/logging.h | 10 ---------- src/libs/tools.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/logging.h b/src/libs/logging.h index 081abc2..8b18267 100644 --- a/src/libs/logging.h +++ b/src/libs/logging.h @@ -160,13 +160,3 @@ extern pthread_mutex_t log_mutex; LOG_PRINTF(COLOR_GRAY, "DEBUG", COLOR_GRAY, _msg, ##__VA_ARGS__); \ } \ } - - -INLINE char *errno_to_string(int error, char *buf, size_t size) { -# if defined(__GLIBC__) && defined(_GNU_SOURCE) - return strerror_r(error, buf, size); -# else - strerror_r(error, buf, size); - return buf; -# endif -} diff --git a/src/libs/tools.h b/src/libs/tools.h index cf7b7fc..1ff84bc 100644 --- a/src/libs/tools.h +++ b/src/libs/tools.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -143,3 +144,12 @@ INLINE int flock_timedwait_monotonic(int fd, long double timeout) { } return retval; } + +INLINE char *errno_to_string(int error, char *buf, size_t size) { +# if defined(__GLIBC__) && defined(_GNU_SOURCE) + return strerror_r(error, buf, size); +# else + strerror_r(error, buf, size); + return buf; +# endif +}