diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-03-24 14:45:15 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-03-24 14:45:15 -0700 |
commit | 2f67e21393c25943f25e116fa6912b7d92dbca4e (patch) | |
tree | fe61561af5d675c13335cef536eaf75731e26d0a | |
parent | 0e1fec841e7cc9291110284a946d1d0489fc7713 (diff) | |
download | plan9front-2f67e21393c25943f25e116fa6912b7d92dbca4e.tar.xz |
turn ptrdiff_t into a 64 bit type
while technically a 32 bit ptrdiff_t is in spec on
systems with 64 bit ponters as long as we guarantee
that individual objects are small enough, this can
confuse legitimate code, so lets fix this.
-rw-r--r-- | amd64/include/ape/stddef.h | 7 | ||||
-rw-r--r-- | arm64/include/ape/stddef.h | 7 | ||||
-rw-r--r-- | sys/include/ape/stddef.h | 6 |
3 files changed, 19 insertions, 1 deletions
diff --git a/amd64/include/ape/stddef.h b/amd64/include/ape/stddef.h new file mode 100644 index 000000000..2a217ba90 --- /dev/null +++ b/amd64/include/ape/stddef.h @@ -0,0 +1,7 @@ +#ifndef __STDDEF_ARCH_H +#define __STDDEF_ARCH_H + +typedef long long _ptrdiff_t; +#include "/sys/include/ape/stddef.h" + +#endif /* __STDDEF_ARCH_H */ diff --git a/arm64/include/ape/stddef.h b/arm64/include/ape/stddef.h new file mode 100644 index 000000000..2a217ba90 --- /dev/null +++ b/arm64/include/ape/stddef.h @@ -0,0 +1,7 @@ +#ifndef __STDDEF_ARCH_H +#define __STDDEF_ARCH_H + +typedef long long _ptrdiff_t; +#include "/sys/include/ape/stddef.h" + +#endif /* __STDDEF_ARCH_H */ diff --git a/sys/include/ape/stddef.h b/sys/include/ape/stddef.h index 28f5707c8..ab6625b4e 100644 --- a/sys/include/ape/stddef.h +++ b/sys/include/ape/stddef.h @@ -1,6 +1,10 @@ #ifndef __STDDEF_H #define __STDDEF_H +#ifndef __STDDEF_ARCH_H +typedef long _ptrdiff_t; +#endif + #ifndef NULL #ifdef __cplusplus #define NULL 0 @@ -10,7 +14,7 @@ #endif #define offsetof(ty,mem) ((size_t) &(((ty *)0)->mem)) -typedef long ptrdiff_t; +typedef _ptrdiff_t ptrdiff_t; #ifndef _SIZE_T #define _SIZE_T typedef unsigned long size_t; |