X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=malloc.c;h=450b6a257a2fb8993cb84f089109646e3cd66348;hb=004283b80f6094bb85aba6f48a74e3c5c34ea24f;hp=fe0b66dd70a6ace7f01144aa70280e0491813c9c;hpb=aea4f609175b8d3694278560443a821f9cb5265c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/malloc.c b/malloc.c index fe0b66d..450b6a2 100644 --- a/malloc.c +++ b/malloc.c @@ -3,6 +3,10 @@ */ /* + * "'The Chamber of Records,' said Gimli. 'I guess that is where we now stand.'" + */ + +/* Here are some notes on configuring Perl's malloc. (For non-perl usage see below.) @@ -255,7 +259,6 @@ # include # include # include -# define _(arg) arg # ifndef Malloc_t # define Malloc_t void * # endif @@ -304,7 +307,11 @@ # ifndef pTHX # define pTHX void # define pTHX_ -# define dTHX extern int Perl___notused +# ifdef HASATTRIBUTE +# define dTHX extern int Perl___notused PERL_UNUSED_DECL +# else +# define dTHX extern int Perl___notused +# endif # define WITH_THX(s) s # endif # ifndef PERL_GET_INTERP @@ -1041,7 +1048,9 @@ Perl_malloc(register size_t nbytes) POW2_OPTIMIZE_ADJUST(nbytes); nbytes += M_OVERHEAD; nbytes = (nbytes + 3) &~ 3; +#if defined(PACK_MALLOC) && !defined(SMALL_BUCKET_VIA_TABLE) do_shifts: +#endif shiftr = (nbytes - 1) >> START_SHIFT; bucket = START_SHIFTS_BUCKET; /* apart from this loop, this is O(1) */ @@ -1586,12 +1595,12 @@ Perl_mfree(void *mp) { dTHX; if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) - Perl_warner(aTHX_ WARN_MALLOC, "%s free() ignored", + Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%s free() ignored (RMAGIC, PERL_CORE)", ovp->ov_rmagic == RMAGIC - 1 ? "Duplicate" : "Bad"); } #else - warn("%s free() ignored", + warn("%s free() ignored (RMAGIC)", ovp->ov_rmagic == RMAGIC - 1 ? "Duplicate" : "Bad"); #endif #else @@ -1599,7 +1608,7 @@ Perl_mfree(void *mp) { dTHX; if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) - Perl_warner(aTHX_ WARN_MALLOC, "%s", "Bad free() ignored"); + Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%s", "Bad free() ignored (PERL_CORE)"); } #else warn("%s", "Bad free() ignored"); @@ -1686,7 +1695,7 @@ Perl_realloc(void *mp, size_t nbytes) { dTHX; if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) - Perl_warner(aTHX_ WARN_MALLOC, "%srealloc() %signored", + Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%srealloc() %signored", (ovp->ov_rmagic == RMAGIC - 1 ? "" : "Bad "), ovp->ov_rmagic == RMAGIC - 1 ? "of freed memory " : ""); @@ -1701,7 +1710,7 @@ Perl_realloc(void *mp, size_t nbytes) { dTHX; if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) - Perl_warner(aTHX_ WARN_MALLOC, "%s", + Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%s", "Bad realloc() ignored"); } #else