macro: Introduce ABS() macro and use it in header files
abs() requires including the entirety of stdlib.h just for a single trivial function. Let's introduce the ABS() macro and use it in header files instead so we can get rid of stdlib.h transitive includes in header files in a later commit.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
/* crypt_dump() internal indentation magic */
|
||||
#define CRYPT_DUMP_LINE_SEP "\n\t "
|
||||
|
||||
@@ -15,7 +17,7 @@
|
||||
#define crypt_log(cd, ...) crypt_logf(cd, CRYPT_LOG_NORMAL, __VA_ARGS__)
|
||||
|
||||
#define crypt_log_full_errno(cd, e, lvl, ...) ({ \
|
||||
int _e = abs(e), _s = errno; \
|
||||
int _e = ABS(e), _s = errno; \
|
||||
errno = _e; \
|
||||
crypt_logf(cd, lvl, __VA_ARGS__); \
|
||||
errno = _s; \
|
||||
|
||||
Reference in New Issue
Block a user