From: Nicholas Clark Date: Sun, 13 Nov 2005 18:47:27 +0000 (+0000) Subject: Fix breakages that prevended -DPERL_POISON from compiling. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=06c0cc96ebd866767a6d107ed78967600f7e0395;p=p5sagit%2Fp5-mst-13.2.git Fix breakages that prevended -DPERL_POISON from compiling. p4raw-id: //depot/perl@26112 --- diff --git a/handy.h b/handy.h index bb4c342..42a1797 100644 --- a/handy.h +++ b/handy.h @@ -713,7 +713,7 @@ Malloc_t Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int li #ifdef PERL_POISON #define Safefree(d) \ - ((d) ? (void)(safefree(MEM_LOG_FREE((Malloc_t)(d)))), Poison(&(d), 1, Malloc_t)) : (void) 0) + ((d) ? (void)(safefree(MEM_LOG_FREE((Malloc_t)(d))), Poison(&(d), 1, Malloc_t)) : (void) 0) #else #define Safefree(d) safefree(MEM_LOG_FREE((Malloc_t)(d))) #endif diff --git a/sv.h b/sv.h index fc8729f..99cfe5a 100644 --- a/sv.h +++ b/sv.h @@ -896,10 +896,17 @@ in gv.h: */ # endif #endif +#ifndef PERL_POISON /* Given that these two are new, there can't be any existing code using them * as LVALUEs */ -#define SvPVX_mutable(sv) (0 + (sv)->sv_u.svu_pv) -#define SvPVX_const(sv) ((const char*)(0 + (sv)->sv_u.svu_pv)) +# define SvPVX_mutable(sv) (0 + (sv)->sv_u.svu_pv) +# define SvPVX_const(sv) ((const char*)(0 + (sv)->sv_u.svu_pv)) +#else +/* Except for the poison code, which uses & to scribble over the pointer after + free() is called. */ +# define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) +# define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) +#endif #define SvIVXx(sv) SvIVX(sv) #define SvUVXx(sv) SvUVX(sv)