The old COW code needs to use SvPVX_mutable when doing copy-on-write.
[p5sagit/p5-mst-13.2.git] / handy.h
diff --git a/handy.h b/handy.h
index b1a7307..534e92e 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -519,11 +519,7 @@ Converts the specified character to lowercase.
 
 /* Line numbers are unsigned, 32 bits. */
 typedef U32 line_t;
-#ifdef lint
-#define NOLINE ((line_t)0)
-#else
 #define NOLINE ((line_t) 4294967295UL)
-#endif
 
 
 /*
@@ -598,8 +594,6 @@ hopefully catches attempts to access uninitialized memory.
 
 =cut */
 
-#ifndef lint
-
 #define NEWSV(x,len)   newSV(len)
 
 #ifdef PERL_MALLOC_WRAP
@@ -611,6 +605,8 @@ hopefully catches attempts to access uninitialized memory.
        (void)((n)>((MEM_SIZE)~0)/sizeof(t)?(Perl_croak_nocontext(a,b),0):0)
 #define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t),
 
+#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > (MEM_SIZE)~0 - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (Perl_croak_nocontext(PL_memory_wrap),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1)))
+
 #else
 
 #define MEM_WRAP_CHECK(n,t)
@@ -618,8 +614,9 @@ hopefully catches attempts to access uninitialized memory.
 #define MEM_WRAP_CHECK_2(n,t,a,b)
 #define MEM_WRAP_CHECK_(n,t)
 
-#endif
+#define PERL_STRLEN_ROUNDUP(n) (((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1)))
 
+#endif
 
 #define New(x,v,n,t)   (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
 #define Newc(x,v,n,t,c)        (v = (MEM_WRAP_CHECK_(n,t) (c*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
@@ -646,23 +643,6 @@ hopefully catches attempts to access uninitialized memory.
 
 #define Poison(d,n,t)  (MEM_WRAP_CHECK_(n,t) (void)memset((char*)(d), 0xAB, (n) * sizeof(t)))
 
-#else /* lint */
-
-#define New(x,v,n,s)   (v = Null(s *))
-#define Newc(x,v,n,s,c)        (v = Null(s *))
-#define Newz(x,v,n,s)  (v = Null(s *))
-#define Renew(v,n,s)   (v = Null(s *))
-#define Move(s,d,n,t)
-#define Copy(s,d,n,t)
-#define Zero(d,n,t)
-#define MoveD(s,d,n,t) d
-#define CopyD(s,d,n,t) d
-#define ZeroD(d,n,t)   d
-#define Poison(d,n,t)
-#define Safefree(d)    (d) = (d)
-
-#endif /* lint */
-
 #ifdef USE_STRUCT_COPY
 #define StructCopy(s,d,t) (*((t*)(d)) = *((t*)(s)))
 #else
@@ -687,10 +667,10 @@ hopefully catches attempts to access uninitialized memory.
 #ifdef USE_ITHREADS
 #define pTHX_FORMAT  "Perl interpreter: 0x%p"
 #define pTHX__FORMAT ", Perl interpreter: 0x%p"
-#define pTHX_VALUE_   (unsigned long)my_perl,
-#define pTHX_VALUE    (unsigned long)my_perl
-#define pTHX__VALUE_ ,(unsigned long)my_perl,
-#define pTHX__VALUE  ,(unsigned long)my_perl
+#define pTHX_VALUE_   (void *)my_perl,
+#define pTHX_VALUE    (void *)my_perl
+#define pTHX__VALUE_ ,(void *)my_perl,
+#define pTHX__VALUE  ,(void *)my_perl
 #else
 #define pTHX_FORMAT 
 #define pTHX__FORMAT