diff options
author | David Mitchell <davem@iabyn.com> | 2012-12-04 11:32:39 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2012-12-04 11:32:39 +0000 |
commit | 4a9a56a75c57646b348598f90875415e994d2f65 (patch) | |
tree | c6b563b3f66247d8ef7596f8010bd6b4fd1c50f6 /sv.h | |
parent | 75a9bf9690b77515a287eb483ea2709b73810c41 (diff) | |
download | perl-4a9a56a75c57646b348598f90875415e994d2f65.tar.gz |
add SvREFCNT_dec_NN()
Like SvREFCNT_dec(), but skips the not null check, making code potentially
smaller and faster.
Also as proof of concept, updates the SvREFCNT_dec's in scope.c where
it's obvious the value can't be NULL. There are still 500+ uses in the
perl core that need evaluating!
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -286,6 +286,11 @@ and faster. =for apidoc Am|void|SvREFCNT_dec|SV* sv Decrements the reference count of the given SV. +=for apidoc Am|void|SvREFCNT_dec_NN|SV* sv +Same as SvREFCNT_dec, but can only be used if you know I<sv> +is not NULL. Since we don't have to check the NULLness, it's faster +and smaller. + =for apidoc Am|svtype|SvTYPE|SV* sv Returns the type of the SV. See C<svtype>. @@ -312,6 +317,7 @@ perform the upgrade if necessary. See C<svtype>. #define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT(MUTABLE_SV(sv))) #define SvREFCNT_dec(sv) S_SvREFCNT_dec(aTHX_ MUTABLE_SV(sv)) +#define SvREFCNT_dec_NN(sv) S_SvREFCNT_dec_NN(aTHX_ MUTABLE_SV(sv)) #define SVTYPEMASK 0xff #define SvTYPE(sv) ((svtype)((sv)->sv_flags & SVTYPEMASK)) |