warn on C<my($foo,$foo)>
[p5sagit/p5-mst-13.2.git] / malloc.c
index bba7741..8bfa0db 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -1377,6 +1377,10 @@ realloc(void *mp, size_t nbytes)
 #endif
                res = cp;
                MUTEX_UNLOCK(&PL_malloc_mutex);
+               DEBUG_m(PerlIO_printf(Perl_debug_log, 
+                             "0x%lx: (%05lu) realloc %ld bytes inplace\n",
+                             (unsigned long)res,(unsigned long)(PL_an++),
+                             (long)size));
        } else if (incr == 1 && (cp - M_OVERHEAD == last_op) 
                   && (onb > (1 << LOG_OF_MIN_ARENA))) {
            MEM_SIZE require, newarena = nbytes, pow;
@@ -1405,6 +1409,10 @@ realloc(void *mp, size_t nbytes)
        } else {
          hard_way:
            MUTEX_UNLOCK(&PL_malloc_mutex);
+           DEBUG_m(PerlIO_printf(Perl_debug_log, 
+                             "0x%lx: (%05lu) realloc %ld bytes the hard way\n",
+                             (unsigned long)cp,(unsigned long)(PL_an++),
+                             (long)size));
            if ((res = (char*)malloc(nbytes)) == NULL)
                return (NULL);
            if (cp != res)                      /* common optimization */
@@ -1412,13 +1420,6 @@ realloc(void *mp, size_t nbytes)
            if (was_alloced)
                free(cp);
        }
-
-       DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lu: (%05lu) rfree\n",
-                             (unsigned long)res,(unsigned long)(PL_an++)));
-       DEBUG_m(PerlIO_printf(Perl_debug_log, 
-                             "0x%lx: (%05lu) realloc %ld bytes\n",
-                             (unsigned long)res,(unsigned long)(PL_an++),
-                             (long)size));
        return ((Malloc_t)res);
 }
 
@@ -1571,11 +1572,7 @@ dump_mstats(char *s)
 
 #ifdef USE_PERL_SBRK
 
-#   ifdef NeXT
-#      define PERL_SBRK_VIA_MALLOC
-#   endif
-
-#   ifdef __MACHTEN_PPC__
+#   if defined(__MACHTEN_PPC__) || defined(__NeXT__)
 #      define PERL_SBRK_VIA_MALLOC
 /*
  * MachTen's malloc() returns a buffer aligned on a two-byte boundary.