aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-06-12 01:41:23 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-06-12 01:42:38 +0200
commitd8361b51da70ada0eb8daa45502f6c37b5e9ac01 (patch)
treecd013b47b65ff01d6e1ded3ace425c727a4bf483 /src
parentlog: thread-safe logging (diff)
downloadcimple-d8361b51da70ada0eb8daa45502f6c37b5e9ac01.tar.gz
cimple-d8361b51da70ada0eb8daa45502f6c37b5e9ac01.zip
log: refactoring
Diffstat (limited to 'src')
-rw-r--r--src/log.h16
1 files changed, 8 insertions, 8 deletions
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