[commit: ghc] master: Remove use of caddr_t (f0f3517)
git at git.haskell.org
git at git.haskell.org
Thu May 19 19:31:32 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f0f351775dfb157889c42863b00a2b331bb422eb/ghc
>---------------------------------------------------------------
commit f0f351775dfb157889c42863b00a2b331bb422eb
Author: Tomas Carnecky <tomas.carnecky at gmail.com>
Date: Thu May 19 21:03:32 2016 +0200
Remove use of caddr_t
> caddr_t is a legacy BSD type associated with some low level calls like
> mmap, and it should never be used in modern code. It was rejected by
> the POSIX standard. The standardized mmap uses void *.
(http://stackoverflow.com/questions/6381526/what-is-the-significance-of-
caddr-t-and-when-is-it-used)
Reviewers: austin, simonmar, rwbarton, bgamari, erikd
Reviewed By: rwbarton, bgamari, erikd
Subscribers: erikd, thomie
Differential Revision: https://phabricator.haskell.org/D2234
>---------------------------------------------------------------
f0f351775dfb157889c42863b00a2b331bb422eb
rts/posix/OSMem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index a06f544..4e6ecc2 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -39,11 +39,11 @@
#include <sys/sysctl.h>
#endif
-static caddr_t next_request = 0;
+static void *next_request = 0;
void osMemInit(void)
{
- next_request = (caddr_t)RtsFlags.GcFlags.heapBase;
+ next_request = (void *)RtsFlags.GcFlags.heapBase;
}
/* -----------------------------------------------------------------------------
@@ -262,7 +262,7 @@ gen_map_mblocks (W_ size)
void *
osGetMBlocks(uint32_t n)
{
- caddr_t ret;
+ void *ret;
W_ size = MBLOCK_SIZE * (W_)n;
if (next_request == 0) {
@@ -289,7 +289,7 @@ osGetMBlocks(uint32_t n)
}
// Next time, we'll try to allocate right after the block we just got.
// ToDo: check that we haven't already grabbed the memory at next_request
- next_request = ret + size;
+ next_request = (char *)ret + size;
return ret;
}
More information about the ghc-commits
mailing list