This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't assume that sizeof(int) >= sizeof(void*)
authorChip Salzenberg <chip@perl.com>
Fri, 21 Feb 1997 14:59:31 +0000 (02:59 +1200)
committerChip Salzenberg <chip@atlantic.net>
Fri, 21 Feb 1997 14:41:53 +0000 (02:41 +1200)
doio.c
malloc.c
regexec.c

diff --git a/doio.c b/doio.c
index 14ecf1a..0db0e1a 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1376,7 +1376,7 @@ SV **sp;
     }
     else
     {
-       I32 i = SvIV(astr);
+       IV i = SvIV(astr);
        a = (char *)i;          /* ouch */
     }
     SETERRNO(0,0);
index 63db091..379861e 100644 (file)
--- 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
index 12908b2..c2ea8ff 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1093,7 +1093,8 @@ char *prog;
                sayNO;
            break;
        default:
-           PerlIO_printf(PerlIO_stderr(), "%x %d\n",(unsigned)scan,scan[1]);
+           PerlIO_printf(PerlIO_stderr(), "%lx %d\n",
+                         (unsigned long)scan, scan[1]);
            FAIL("regexp memory corruption");
        }
        scan = next;