This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't test the core XS code yet with PERL_DEBUG_COW > 1
[perl5.git] / handy.h
diff --git a/handy.h b/handy.h
index 067999a..534e92e 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -605,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)
@@ -612,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)))))