summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-04-10 20:39:43 +0200
committerTom Gundersen <teg@jklm.no>2015-04-16 16:47:23 +0100
commitaa02962840e10fa7d052760b98a5c092dd0990e1 (patch)
tree1727b9e7fe7fe440b3d6b7d3f0b27a19594c9ba5
parent2d0c1561340efff3265fe89b05eae4ee8f4037a7 (diff)
shared: move assert_return_errno() from libudev
This should not be used for any new code, as we don't set errno in new code, but there are several legacy users, so let's keep it in shared.
-rw-r--r--src/libudev/libudev-device-internal.h9
-rw-r--r--src/shared/macro.h9
2 files changed, 9 insertions, 9 deletions
diff --git a/src/libudev/libudev-device-internal.h b/src/libudev/libudev-device-internal.h
index 18ae7a93f9..b6ecce80e9 100644
--- a/src/libudev/libudev-device-internal.h
+++ b/src/libudev/libudev-device-internal.h
@@ -51,12 +51,3 @@ struct udev_device {
};
struct udev_device *udev_device_new(struct udev *udev);
-
-#define assert_return_errno(expr, r, err) \
- do { \
- if (_unlikely_(!(expr))) { \
- log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
- errno = err; \
- return (r); \
- } \
- } while (false)
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 7f89951d62..7ae1ed80b6 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -256,6 +256,15 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
} \
} while (false)
+#define assert_return_errno(expr, r, err) \
+ do { \
+ if (_unlikely_(!(expr))) { \
+ log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ errno = 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 int) ((uintptr_t) (p)))