diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-09-24 20:33:03 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-09-24 20:33:03 -0700 |
commit | 06c841cf64c10f912e4cb0d12dbfc0add671bb81 (patch) | |
tree | b02e773cef0db952bb77579942f1334d3183b9d8 /sv.c | |
parent | 078504b2d0c069e5cefbe4670341aa18838d452d (diff) | |
download | perl-06c841cf64c10f912e4cb0d12dbfc0add671bb81.tar.gz |
[perl #76814] FETCH called twice - !
This fixes ! by changing sv_2bool to sv_2bool_flags (with a macro
wrapper) and adding SvTRUE_nomg. It also corrects the docs that state
incorrectly that SvTRUE does not handle magic.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -3072,20 +3072,28 @@ Perl_sv_2pvutf8(pTHX_ register SV *const sv, STRLEN *const lp) /* =for apidoc sv_2bool -This function is only called on magical items, and is only used by -sv_true() or its macro equivalent. +This macro is only used by sv_true() or its macro equivalent, and only if +the latter's argument is neither SvPOK, SvIOK nor SvNOK. +It calls sv_2bool_flags with the SV_GMAGIC flag. + +=for apidoc sv_2bool_flags + +This function is only used by sv_true() and friends, and only if +the latter's argument is neither SvPOK, SvIOK nor SvNOK. If the flags +contain SV_GMAGIC, then it does an mg_get() first. + =cut */ bool -Perl_sv_2bool(pTHX_ register SV *const sv) +Perl_sv_2bool_flags(pTHX_ register SV *const sv, const I32 flags) { dVAR; - PERL_ARGS_ASSERT_SV_2BOOL; + PERL_ARGS_ASSERT_SV_2BOOL_FLAGS; - SvGETMAGIC(sv); + if(flags & SV_GMAGIC) SvGETMAGIC(sv); if (!SvOK(sv)) return 0; |