summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-03-12 19:14:13 +0000
committerDavid Mitchell <davem@iabyn.com>2014-03-12 20:19:03 +0000
commit5d9574c10ca04dcefc1cac5441cb321f7bb4cc37 (patch)
tree66acefea54382fa30b9c1c2b73c99d578f65c027 /handy.h
parent85c8e3067c12431ded3d5289a8ec16cf2e33ebaf (diff)
downloadperl-5d9574c10ca04dcefc1cac5441cb321f7bb4cc37.tar.gz
sprinkle LIKELY() on pp_hot.c scope.c and some *.h
I've gone through pp_hot.c and scope.c and added LIKELY() or UNLIKELY() to all conditionals where I understand the code well enough to know that a particular branch is or isn't likely to be taken very often. I also processed some of the .h files which contain commonly used macros.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/handy.h b/handy.h
index 2f0132f572..16264fe140 100644
--- a/handy.h
+++ b/handy.h
@@ -1793,9 +1793,9 @@ PoisonWith(0xEF) for catching access to freed memory.
* (U16)n > (size_t)~0/sizeof(U16) always being false. */
#ifdef PERL_MALLOC_WRAP
#define MEM_WRAP_CHECK(n,t) \
- (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (croak_memory_wrap(),0))
+ (void)(UNLIKELY(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t)) && (croak_memory_wrap(),0))
#define MEM_WRAP_CHECK_1(n,t,a) \
- (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (Perl_croak_nocontext("%s",(a)),0))
+ (void)(UNLIKELY(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t)) && (Perl_croak_nocontext("%s",(a)),0))
#define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t),
#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > MEM_SIZE_MAX - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (croak_memory_wrap(),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1)))