From d8361b51da70ada0eb8daa45502f6c37b5e9ac01 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 12 Jun 2023 01:41:23 +0200 Subject: log: refactoring --- src/log.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/log.h b/src/log.h index da12efe..6ad16f3 100644 --- a/src/log.h +++ b/src/log.h @@ -70,33 +70,33 @@ static inline void log_prefix(FILE *dest) funlockfile(stderr); \ } while (0) -#define log_errno(s) \ +#define log_errno(fn) \ do { \ flockfile(stderr); \ log_err_prefix(); \ - perror(s); \ + perror(fn); \ funlockfile(stderr); \ } while (0) -#define log_errno_if(expr, s) \ +#define log_errno_if(expr, fn) \ do { \ int CONCAT(ret, __LINE__) = expr; \ if (CONCAT(ret, __LINE__) < 0) \ - log_errno(s); \ + log_errno(fn); \ } while (0) -#define pthread_errno(var, s) \ +#define pthread_errno(var, fn) \ do { \ errno = var; \ - log_errno(s); \ + log_errno(fn); \ var = -var; \ } while (0) -#define pthread_errno_if(expr, s) \ +#define pthread_errno_if(expr, fn) \ do { \ int CONCAT(ret, __LINE__) = expr; \ if (CONCAT(ret, __LINE__)) \ - pthread_errno(CONCAT(ret, __LINE__), s); \ + pthread_errno(CONCAT(ret, __LINE__), fn); \ } while (0) #endif -- cgit v1.2.3