This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #118297] Fix interpolating downgraded variables into upgraded regexp
[perl5.git] / sv.h
diff --git a/sv.h b/sv.h
index 4bfbf9c..449b23e 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -22,7 +22,6 @@ in the C<svtype> enum.  Test these flags with the C<SvTYPE> macro.
 The types are:
 
     SVt_NULL
-    SVt_BIND (unused)
     SVt_IV
     SVt_NV
     SVt_RV
@@ -120,7 +119,7 @@ Type flag for I/O objects.  See L</svtype>.
 
 typedef enum {
        SVt_NULL,       /* 0 */
-       SVt_BIND,       /* 1 */
+       SVt_DUMMY,      /* 1 */
        SVt_IV,         /* 2 */
        SVt_NV,         /* 3 */
        /* RV was here, before it was merged with IV.  */
@@ -1490,11 +1489,13 @@ stringified version becoming C<SvPOK>.  Handles 'get' magic.  See also
 C<SvPVx> for a version which guarantees to evaluate sv only once.
 
 Note that there is no guarantee that the return value of C<SvPV()> is
-equal to C<SvPVX(sv)> (or even that C<SvPVX(sv)> contains valid data), due
-to the way that things like overloading and Copy-On-Write are handled.  In
-these cases, the return value may point to a temporary buffer or similar.
-If you absolutely need the SvPVX field to be valid (for example, if you
-intend to write to it), then see L</SvPV_force>.
+equal to C<SvPVX(sv)>, or that C<SvPVX(sv)> contains valid data, or that
+successive calls to C<SvPV(sv)) will return the same pointer value each
+time. This is due to the way that things like overloading and
+Copy-On-Write are handled.  In these cases, the return value may point to
+a temporary buffer or similar.  If you absolutely need the SvPVX field to
+be valid (for example, if you intend to write to it), then see
+L</SvPV_force>.
 
 =for apidoc Am|char*|SvPVx|SV* sv|STRLEN len
 A version of C<SvPV> which guarantees to evaluate C<sv> only once.
@@ -1737,9 +1738,10 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>.
 #define SvTRUE_common(sv,fallback) (                   \
       !SvOK(sv)                                                \
        ? 0                                             \
-    : (SvFLAGS(sv) & (SVf_POK|SVf_IOK|SVf_NOK))                \
-       ? (   (SvPOK(sv) && SvPVXtrue(sv))              \
-          || (SvIOK(sv) && SvIVX(sv) != 0)             \
+    : SvPOK(sv)                                                \
+       ? SvPVXtrue(sv)                                 \
+    : (SvFLAGS(sv) & (SVf_IOK|SVf_NOK))                        \
+       ? (   (SvIOK(sv) && SvIVX(sv) != 0)             \
           || (SvNOK(sv) && SvNVX(sv) != 0.0))          \
     : (fallback))