diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-12 01:41:23 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-12 01:42:38 +0200 |
commit | d8361b51da70ada0eb8daa45502f6c37b5e9ac01 (patch) | |
tree | cd013b47b65ff01d6e1ded3ace425c727a4bf483 /src/log.h | |
parent | log: thread-safe logging (diff) | |
download | cimple-d8361b51da70ada0eb8daa45502f6c37b5e9ac01.tar.gz cimple-d8361b51da70ada0eb8daa45502f6c37b5e9ac01.zip |
log: refactoring
Diffstat (limited to 'src/log.h')
-rw-r--r-- | src/log.h | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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 |