libudev: introduce return_with_errno() and use it where applicable

This commit is contained in:
Yu Watanabe
2018-11-22 23:49:55 +09:00
parent 6f9fe58189
commit fd05c424c0
7 changed files with 94 additions and 160 deletions
+6
View File
@@ -334,6 +334,12 @@ static inline int __coverity_check__(int condition) {
} \
} while (false)
#define return_with_errno(r, err) \
do { \
errno = abs(err); \
return r; \
} while (false)
#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
#define INT_TO_PTR(u) ((void *) ((intptr_t) (u)))
#define PTR_TO_UINT(p) ((unsigned) ((uintptr_t) (p)))