This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Renamed malloc.c ASSERT() macro to P_ASSERT() because
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 6 Nov 1998 08:05:31 +0000 (08:05 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 6 Nov 1998 08:05:31 +0000 (08:05 +0000)
ASSERT() causes problems in {NeXTStep,OpenStep}.

From: Hans Mulder <hansm@icgroup.nl>
To: Jarkko Hietaniemi <jhi@cc.hut.fi>
Subject: Re: Not OK: perl 5.00553 on OPENSTEP-Mach 4_1 (UNINSTALLED)
Date: Fri,  6 Nov 98 01:27:41 +0100
Message-Id: <9811060025.AA27389@icgned.icgroup.nl>

and

From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: ASSERT() in malloc.c
To: jhi@iki.fi
Date: Fri, 6 Nov 1998 02:59:29 -0500 (EST)
Message-Id: <199811060759.CAA18915@monk.mps.ohio-state.edu>

p4raw-id: //depot/cfgperl@2209

malloc.c

index 13f20ff..65cddbe 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -670,7 +670,7 @@ static  u_int start_slack;
 static u_int goodsbrk;
 
 #ifdef DEBUGGING
-#define        ASSERT(p,diag)   if (!(p)) botch(diag,STRINGIFY(p));  else
+#define        P_ASSERT(p,diag)   if (!(p)) botch(diag,STRINGIFY(p));  else
 static void
 botch(char *diag, char *s)
 {
@@ -678,7 +678,7 @@ botch(char *diag, char *s)
        PerlProc_abort();
 }
 #else
-#define        ASSERT(p, diag)
+#define        P_ASSERT(p, diag)
 #endif
 
 Malloc_t
@@ -1219,7 +1219,7 @@ free(void *mp)
            }
        MUTEX_LOCK(&PL_malloc_mutex);
 #ifdef RCHECK
-       ASSERT(ovp->ov_rmagic == RMAGIC, "chunk's head overwrite");
+       P_ASSERT(ovp->ov_rmagic == RMAGIC, "chunk's head overwrite");
        if (OV_INDEX(ovp) <= MAX_SHORT_BUCKET) {
            int i;
            MEM_SIZE nbytes = ovp->ov_size + 1;
@@ -1227,16 +1227,16 @@ free(void *mp)
            if ((i = nbytes & 3)) {
                i = 4 - i;
                while (i--) {
-                   ASSERT(*((char *)((caddr_t)ovp + nbytes - RSLOP + i))
+                   P_ASSERT(*((char *)((caddr_t)ovp + nbytes - RSLOP + i))
                           == RMAGIC_C, "chunk's tail overwrite");
                }
            }
            nbytes = (nbytes + 3) &~ 3; 
-           ASSERT(*(u_int *)((caddr_t)ovp + nbytes - RSLOP) == RMAGIC, "chunk's tail overwrite");          
+           P_ASSERT(*(u_int *)((caddr_t)ovp + nbytes - RSLOP) == RMAGIC, "chunk's tail overwrite");        
        }
        ovp->ov_rmagic = RMAGIC - 1;
 #endif
-       ASSERT(OV_INDEX(ovp) < NBUCKETS, "chunk's head overwrite");
+       P_ASSERT(OV_INDEX(ovp) < NBUCKETS, "chunk's head overwrite");
        size = OV_INDEX(ovp);
        ovp->ov_next = nextf[size];
        nextf[size] = ovp;
@@ -1352,11 +1352,11 @@ realloc(void *mp, size_t nbytes)
                       if ((i = nb & 3)) {
                           i = 4 - i;
                           while (i--) {
-                              ASSERT(*((char *)((caddr_t)ovp + nb - RSLOP + i)) == RMAGIC_C, "chunk's tail overwrite");
+                              P_ASSERT(*((char *)((caddr_t)ovp + nb - RSLOP + i)) == RMAGIC_C, "chunk's tail overwrite");
                           }
                       }
                       nb = (nb + 3) &~ 3; 
-                      ASSERT(*(u_int *)((caddr_t)ovp + nb - RSLOP) == RMAGIC, "chunk's tail overwrite");
+                      P_ASSERT(*(u_int *)((caddr_t)ovp + nb - RSLOP) == RMAGIC, "chunk's tail overwrite");
                        /*
                         * Convert amount of memory requested into
                         * closest block size stored in hash buckets