diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-23 13:52:54 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-23 15:25:43 +0200 |
commit | a0d3c03950d20e57074e87a8b6314ebab9fb5e15 (patch) | |
tree | 32ee5eacc4d9813c40bf0a5fc2be540e22ba9f2a /Libraries | |
parent | 8ec8304d74c029ddb10be2b5b07c11dc0f768446 (diff) | |
download | serenity-a0d3c03950d20e57074e87a8b6314ebab9fb5e15.zip |
LibC: Declare ssize_t in a platform-agnostic way
While the compiler provides __SIZE_TYPE__ for declaring size_t,
there's unfortunately no __SSIZE_TYPE__ for ssize_t.
However, we can trick the preprocessor into doing what we want anyway
by doing "#define unsigned signed" before using __SIZE_TYPE__ again.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibC/stddef.h | 5 | ||||
-rw-r--r-- | Libraries/LibC/sys/types.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/Libraries/LibC/stddef.h b/Libraries/LibC/stddef.h index 39d865895f..4af93185f5 100644 --- a/Libraries/LibC/stddef.h +++ b/Libraries/LibC/stddef.h @@ -40,4 +40,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __SIZE_TYPE__ size_t; +/* There is no __SSIZE_TYPE__ but we can trick the preprocessor into defining it for us anyway! */ +#define unsigned signed +typedef __SIZE_TYPE__ ssize_t; +#undef unsigned + #endif diff --git a/Libraries/LibC/sys/types.h b/Libraries/LibC/sys/types.h index 030d36ba28..0e8bfbcf33 100644 --- a/Libraries/LibC/sys/types.h +++ b/Libraries/LibC/sys/types.h @@ -45,9 +45,6 @@ typedef int __pid_t; typedef int id_t; -typedef int __ssize_t; -#define ssize_t __ssize_t - typedef __WINT_TYPE__ wint_t; typedef uint32_t ino_t; |