diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-26 07:15:03 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-26 07:15:45 +0200 |
commit | 93b8646855353ab3adfe5fea8ccb5b0842ad8a0d (patch) | |
tree | c87ac95cd819f654d60e360f84a5559faa7de9fe /src/log.h | |
parent | fix macros (diff) | |
download | cimple-93b8646855353ab3adfe5fea8ccb5b0842ad8a0d.tar.gz cimple-93b8646855353ab3adfe5fea8ccb5b0842ad8a0d.zip |
add check_errno macro
Diffstat (limited to 'src/log.h')
-rw-r--r-- | src/log.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -15,6 +15,13 @@ perror(s); \ } while (0) +#define check_errno(expr, s) \ + do { \ + int CONCAT(ret, __LINE__) = expr; \ + if (CONCAT(ret, __LINE__) < 0) \ + print_errno(s); \ + } while (0) + #define pthread_print_errno(var, s) \ do { \ errno = var; \ |