summaryrefslogtreecommitdiff
path: root/rts/RtsUtils.h
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-05-12 15:45:10 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-12 17:33:39 +0200
commit0c0129b6a82a87a9bba19f27a4b19fec9ccc5a8d (patch)
treec5bea455e1206e334f1f1046aadf13adf5464fbd /rts/RtsUtils.h
parent995cf0f356ef3a8b7a394de640a853fd6ca9c2b5 (diff)
downloadhaskell-0c0129b6a82a87a9bba19f27a4b19fec9ccc5a8d.tar.gz
RtsUtils: Use `size_t` instead of `int` where appropriate
Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: austin, hvr, bgamari, simonmar, hsyl20 Reviewed By: hvr, bgamari, simonmar, hsyl20 Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2201
Diffstat (limited to 'rts/RtsUtils.h')
-rw-r--r--rts/RtsUtils.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h
index d76c921a36..2d5e5de02c 100644
--- a/rts/RtsUtils.h
+++ b/rts/RtsUtils.h
@@ -18,12 +18,12 @@
void initAllocator(void);
void shutdownAllocator(void);
-void *stgMallocBytes(int n, char *msg)
+void *stgMallocBytes(size_t n, char *msg)
GNUC3_ATTRIBUTE(__malloc__);
-void *stgReallocBytes(void *p, int n, char *msg);
+void *stgReallocBytes(void *p, size_t n, char *msg);
-void *stgCallocBytes(int n, int m, char *msg)
+void *stgCallocBytes(size_t n, size_t m, char *msg)
GNUC3_ATTRIBUTE(__malloc__);
char *stgStrndup(const char *s, size_t n);