__UNCONST: use uintptr_t instead of unsigned long.

The width of unsigned long matching the width of a pointer isn't
guaranteed by any standard, though it is a requirement of the Linux
syscall API. Using uintptr_t directly is always correct.
This commit is contained in:
Érico Rolim 2020-12-26 17:51:22 -03:00 committed by Duncan Overbruck
parent 47df729bcc
commit 0b23de1bec
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | EXTRACT_FLAGS #define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | EXTRACT_FLAGS
#ifndef __UNCONST #ifndef __UNCONST
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) #define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
#endif #endif
/* libarchive compat */ /* libarchive compat */

View File

@ -168,7 +168,7 @@ fetchIO *ftp_request(struct url *, const char *, const char *,
#define CHECK_FLAG(x) (flags && strchr(flags, (x))) #define CHECK_FLAG(x) (flags && strchr(flags, (x)))
#ifndef __UNCONST #ifndef __UNCONST
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) #define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
#endif #endif
#endif #endif