summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-12-31 00:08:00 +0000
committerNicholas Clark <nick@ccl4.org>2006-12-31 00:08:00 +0000
commit1cb9cd5016282146cd55ab904078500def5f5754 (patch)
tree4952a1cfb2e8ca1b21b5c8c452ec04043a27857e /sv.h
parentf6fd7794b9baf00eb9b1d47e4ad481f2e8866e76 (diff)
downloadperl-1cb9cd5016282146cd55ab904078500def5f5754.tar.gz
Move SVt_BIND to be the lowest type after SVt_NULL. This will force all
code attempting to upgrade a BIND to anything into sv_upgrade(), which for now will croak, but in future can DTRT, for whatever TRT is decided to be. Make SvOK() check the flags of the referenant for a BIND, as I envisage that the only flag bit that will get set on a BIND is SVf_UTF8 even if the referant has a defined value. p4raw-id: //depot/perl@29642
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/sv.h b/sv.h
index f7a7ba0935..0bafb9914d 100644
--- a/sv.h
+++ b/sv.h
@@ -45,10 +45,10 @@ Type flag for code refs. See C<svtype>.
typedef enum {
SVt_NULL, /* 0 */
- SVt_IV, /* 1 */
- SVt_NV, /* 2 */
- SVt_RV, /* 3 */
- SVt_BIND, /* 4 */
+ SVt_BIND, /* 1 */
+ SVt_IV, /* 2 */
+ SVt_NV, /* 3 */
+ SVt_RV, /* 4 */
SVt_PV, /* 5 */
SVt_PVIV, /* 6 */
SVt_PVNV, /* 7 */
@@ -942,7 +942,9 @@ Set the actual length of the string which is in the SV. See C<SvIV_set>.
#define assert_not_glob(sv)
#endif
-#define SvOK(sv) (SvFLAGS(sv) & SVf_OK)
+#define SvOK(sv) ((SvTYPE(sv) == SVt_BIND) \
+ ? (SvFLAGS(SvRV(sv)) & SVf_OK) \
+ : (SvFLAGS(sv) & SVf_OK))
#define SvOK_off(sv) (assert_not_ROK(sv) assert_not_glob(sv) \
SvFLAGS(sv) &= ~(SVf_OK| \
SVf_IVisUV|SVf_UTF8), \