summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-09-24 20:33:03 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-09-24 20:33:03 -0700
commit06c841cf64c10f912e4cb0d12dbfc0add671bb81 (patch)
treeb02e773cef0db952bb77579942f1334d3183b9d8 /sv.c
parent078504b2d0c069e5cefbe4670341aa18838d452d (diff)
downloadperl-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.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sv.c b/sv.c
index 79472a4768..309ee6d279 100644
--- a/sv.c
+++ b/sv.c
@@ -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;