summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-02-22 02:59:31 +1200
committerChip Salzenberg <chip@atlantic.net>1997-02-22 02:41:53 +1200
commitc030ccd9d6ca0638398c27d7169051214732a502 (patch)
tree61d52861454e1da56f33e2907cce0afbe114d43b /malloc.c
parent16ddee0dc82748918bb875d781b3839ea2e6d9ee (diff)
downloadperl-c030ccd9d6ca0638398c27d7169051214732a502.tar.gz
Don't assume that sizeof(int) >= sizeof(void*)
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/malloc.c b/malloc.c
index 63db091a78..379861ebe9 100644
--- a/malloc.c
+++ b/malloc.c
@@ -383,16 +383,13 @@ morecore(bucket)
#ifndef atarist /* on the atari we dont have to worry about this */
op = (union overhead *)sbrk(0);
# ifndef I286
-# ifdef PACK_MALLOC
- if ((u_int)op & 0x7ff)
- (void)sbrk(slack = 2048 - ((u_int)op & 0x7ff));
-# else
- if ((u_int)op & 0x3ff)
- (void)sbrk(slack = 1024 - ((u_int)op & 0x3ff));
-# endif
+ if ((UV)op & (0x7FF >> CHUNK_SHIFT)) {
+ slack = (0x800 >> CHUNK_SHIFT) - ((UV)op & (0x7FF >> CHUNK_SHIFT));
+ (void)sbrk(slack);
# if defined(DEBUGGING_MSTATS)
- sbrk_slack += slack;
+ sbrk_slack += slack;
# endif
+ }
# else
/* The sbrk(0) call on the I286 always returns the next segment */
# endif
@@ -427,11 +424,11 @@ morecore(bucket)
*/
#ifndef I286
# ifdef PACK_MALLOC
- if ((u_int)op & 0x7ff)
+ if ((UV)op & 0x7FF)
croak("panic: Off-page sbrk");
# endif
- if ((u_int)op & 7) {
- op = (union overhead *)(((MEM_SIZE)op + 8) &~ 7);
+ if ((UV)op & 7) {
+ op = (union overhead *)(((UV)op + 8) & ~7);
nblks--;
}
#else