Skip to content

Commit e0739a7

Browse files
committed
Make err.h a bit more Windows friendly
Using unsigned long to hold pointers is a linuxism, clean it up. Signed-off-by: Jens Axboe <[email protected]>
1 parent f0fdbca commit e0739a7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

err.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@
1111
*/
1212
#define MAX_ERRNO 4095
1313

14-
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
14+
#define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO)
1515

16-
static inline void *ERR_PTR(long error)
16+
static inline void *ERR_PTR(uintptr_t error)
1717
{
1818
return (void *) error;
1919
}
2020

21-
static inline long PTR_ERR(const void *ptr)
21+
static inline uintptr_t PTR_ERR(const void *ptr)
2222
{
23-
return (long) ptr;
23+
return (uintptr_t) ptr;
2424
}
2525

26-
static inline long IS_ERR(const void *ptr)
26+
static inline uintptr_t IS_ERR(const void *ptr)
2727
{
28-
return IS_ERR_VALUE((unsigned long)ptr);
28+
return IS_ERR_VALUE((uintptr_t)ptr);
2929
}
3030

31-
static inline long IS_ERR_OR_NULL(const void *ptr)
31+
static inline uintptr_t IS_ERR_OR_NULL(const void *ptr)
3232
{
33-
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
33+
return !ptr || IS_ERR_VALUE((uintptr_t)ptr);
3434
}
3535

3636
static inline int PTR_ERR_OR_ZERO(const void *ptr)

0 commit comments

Comments
 (0)