This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use 0x40008000 in SvFLAGS() for SVpad_NAME, not 0x40000000
authorNicholas Clark <nick@ccl4.org>
Tue, 24 May 2011 10:17:13 +0000 (11:17 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 07:40:01 +0000 (09:40 +0200)
This eliminates potential confusion between SVpad_NAME and SVpbm_VALID.

sv.h

diff --git a/sv.h b/sv.h
index 71faf2b..3d48316 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -367,8 +367,21 @@ perform the upgrade if necessary.  See C<svtype>.
 
 /* PVHV */
 #define SVphv_SHAREKEYS 0x20000000  /* PVHV keys live on shared string table */
 
 /* PVHV */
 #define SVphv_SHAREKEYS 0x20000000  /* PVHV keys live on shared string table */
-/* PVNV, PVMG, presumably only inside pads */
-#define SVpad_NAME     0x40000000  /* This SV is a name in the PAD, so
+
+/* PVNV, PVMG only, and only used in pads. Should be safe to test on any scalar
+   SV, as the core is careful to avoid setting both.
+
+   SVf_POK, SVp_POK also set:
+   0x00004400   Normal
+   0x0000C400   Studied (SvSCREAM)
+   0x40004400   FBM compiled (SvVALID)
+   0x4000C400   pad name.
+
+   0x00008000   GV with GP
+   0x00008800   RV with PCS imported
+*/
+#define SVpad_NAME     (SVp_SCREAM|SVpbm_VALID)
+                                   /* This SV is a name in the PAD, so
                                       SVpad_TYPED, SVpad_OUR and SVpad_STATE
                                       apply */
 /* PVAV */
                                       SVpad_TYPED, SVpad_OUR and SVpad_STATE
                                       apply */
 /* PVAV */