aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-09-06 19:34:02 +0200
committerSverker Eriksson <[email protected]>2013-09-30 17:45:45 +0200
commit2d64c6e31966d9e63d1aa1835d41ded22f799175 (patch)
tree844ef2993f6df0e01272a6404666c164390e172c /erts/emulator
parent0820017c421bfab27d23aff4da474974f988006c (diff)
downloadotp-2d64c6e31966d9e63d1aa1835d41ded22f799175.tar.gz
otp-2d64c6e31966d9e63d1aa1835d41ded22f799175.tar.bz2
otp-2d64c6e31966d9e63d1aa1835d41ded22f799175.zip
erts: Fix ASSERT bug and void* arithmetics
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/sys/common/erl_mseg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c
index b21d6ca393..09035ca73e 100644
--- a/erts/emulator/sys/common/erl_mseg.c
+++ b/erts/emulator/sys/common/erl_mseg.c
@@ -515,7 +515,7 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
if (MSEG_FLG_IS_2POW(flags)) {
int i, ix = SIZE_TO_CACHE_AREA_IDX(size);
- void *seg;
+ char *seg;
cache_t *c;
Uint csize;
@@ -533,7 +533,7 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
ASSERT(MAP_IS_ALIGNED(c->seg));
csize = c->size;
- seg = c->seg;
+ seg = (char*) c->seg;
mk->cache_size--;
mk->cache_hits++;
@@ -545,11 +545,11 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
ASSERT(!(mk->cache_size < 0));
if (csize != size) {
- void *destr_seg = ((char *) seg) + size;
+ char *destr_seg = seg + size;
UWord destr_size = csize - size;
- mseg_destroy(mk->ma, ERTS_MSEG_FLG_2POW, mk, &destr_seg, &destr_size);
+ mseg_destroy(mk->ma, ERTS_MSEG_FLG_2POW, mk, (void**)&destr_seg, &destr_size);
*size_p = (UWord) (destr_seg - seg);
- ASSERT(c->seg + c->size == destr_seg + destr_size);
+ ASSERT(seg + csize == destr_seg + destr_size);
}
return seg;