diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-07-28 18:32:02 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-07-28 22:20:05 -0700 |
commit | a11eaecb3511133877ccbbc89337da7a30e8f21b (patch) | |
tree | 956d89a8b1a804869bfe873da88f5a1b67251948 /sv.h | |
parent | 153920a10f42560914e3260d6a282b2f08eddfa5 (diff) | |
download | perl-a11eaecb3511133877ccbbc89337da7a30e8f21b.tar.gz |
sv.h: Document SvTHINKFIRST
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -962,6 +962,30 @@ the scalar's value cannot change unless written to. #define SvPCS_IMPORTED_on(sv) (SvFLAGS(sv) |= (SVf_ROK|SVprv_PCS_IMPORTED)) #define SvPCS_IMPORTED_off(sv) (SvFLAGS(sv) &= ~(SVf_ROK|SVprv_PCS_IMPORTED)) +/* +=for apidoc m|U32|SvTHINKFIRST|SV *sv + +A quick flag check to see whether an sv should be passed to sv_force_normal +to be "downgraded" before SvIVX or SvPVX can be modified directly. + +For example, if your scalar is a reference and you want to modify the SvIVX +slot, you can't just do SvROK_off, as that will leak the referent. + +This is used internally by various sv-modifying functions, such as +sv_setsv, sv_setiv and sv_pvn_force. + +One case that this does not handle is a gv without SvFAKE set. After + + if (SvTHINKFIRST(gv)) sv_force_normal(gv); + +it will still be a gv. + +SvTHINKFIRST sometimes produces false positives. In those cases +sv_force_normal does nothing. + +=cut +*/ + #define SvTHINKFIRST(sv) (SvFLAGS(sv) & SVf_THINKFIRST) #define SvPADMY(sv) (SvFLAGS(sv) & SVs_PADMY) |