|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/3] xen/err: Use static inlines and boolean types
IS_ERR() and IS_ERR_OR_NULL() both return boolean values.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
xen/include/xen/err.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/xen/include/xen/err.h b/xen/include/xen/err.h
index 2f29b57..ef77992 100644
--- a/xen/include/xen/err.h
+++ b/xen/include/xen/err.h
@@ -2,6 +2,7 @@
#define __XEN_ERR_H__
#include <xen/compiler.h>
+#include <xen/stdbool.h>
#include <xen/errno.h>
/*
@@ -14,7 +15,10 @@
*/
#define MAX_ERRNO 4095
-#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
+static inline bool IS_ERR_VALUE(unsigned long x)
+{
+ return x >= (unsigned long)-MAX_ERRNO;
+}
static inline void *__must_check ERR_PTR(long error)
{
@@ -26,12 +30,12 @@ static inline long __must_check PTR_ERR(const void *ptr)
return (long)ptr;
}
-static inline long __must_check IS_ERR(const void *ptr)
+static inline bool __must_check IS_ERR(const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
-static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
+static inline bool __must_check IS_ERR_OR_NULL(const void *ptr)
{
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |