summaryrefslogtreecommitdiff
path: root/hv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-01-30 12:59:12 +0000
committerNicholas Clark <nick@ccl4.org>2006-01-30 12:59:12 +0000
commitde61663159118b735969bec9539d9251323990fa (patch)
tree08bacbcc1bfb10dc496f8287872d3c6c42abe2ec /hv.h
parent21c1191d96d28acb87f4479c4eef93ca5aef5405 (diff)
downloadperl-de61663159118b735969bec9539d9251323990fa.tar.gz
Use a union for storing the shared hash key reference count, rather
than messy pointer hacks. p4raw-id: //depot/perl@27000
Diffstat (limited to 'hv.h')
-rw-r--r--hv.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/hv.h b/hv.h
index d0ac0e8054..fd0cf2eda2 100644
--- a/hv.h
+++ b/hv.h
@@ -15,7 +15,10 @@ struct he {
body arenas */
HE *hent_next; /* next entry in chain */
HEK *hent_hek; /* hash key */
- SV *hent_val; /* scalar value that was hashed */
+ union {
+ SV *hent_val; /* scalar value that was hashed */
+ Size_t hent_refcount; /* references for this shared hash key */
+ } he_valu;
};
/* hash key -- defined separately for use as shared pointer */
@@ -291,7 +294,7 @@ C<SV*>.
#define HeKREHASH(he) HEK_REHASH(HeKEY_hek(he))
#define HeKLEN_UTF8(he) (HeKUTF8(he) ? -HeKLEN(he) : HeKLEN(he))
#define HeKFLAGS(he) HEK_FLAGS(HeKEY_hek(he))
-#define HeVAL(he) (he)->hent_val
+#define HeVAL(he) (he)->he_valu.hent_val
#define HeHASH(he) HEK_HASH(HeKEY_hek(he))
#define HePV(he,lp) ((HeKLEN(he) == HEf_SVKEY) ? \
SvPV(HeKEY_sv(he),lp) : \
@@ -372,7 +375,7 @@ C<SV*>.
(++(((struct shared_he *)(((char *)hek) \
- STRUCT_OFFSET(struct shared_he, \
shared_he_hek))) \
- ->shared_he_he.hent_val), \
+ ->shared_he_he.he_valu.hent_refcount), \
hek)
/*