summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAnno Siegel <anno4000@lublin.zrz.tu-berlin.de>2006-06-26 20:05:53 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-26 16:32:16 +0000
commita607227a3e6385121d3bf032568fb6b9c2dd6e68 (patch)
tree08cd6581bd616bd9960eb82661d0c12c93de65e5 /ext
parent7b52221de7fe1243a09b164fd1b22d32ce600210 (diff)
downloadperl-a607227a3e6385121d3bf032568fb6b9c2dd6e68.tar.gz
Re: [PATCH] Hash::Util::FieldHash
Message-Id: <133195AB-599D-49EC-8CFE-D67299D947EB@mailbox.tu-berlin.de> p4raw-id: //depot/perl@28431
Diffstat (limited to 'ext')
-rw-r--r--ext/Hash/Util/FieldHash/Changes3
-rw-r--r--ext/Hash/Util/FieldHash/FieldHash.xs14
-rw-r--r--ext/Hash/Util/FieldHash/Makefile.PL12
3 files changed, 20 insertions, 9 deletions
diff --git a/ext/Hash/Util/FieldHash/Changes b/ext/Hash/Util/FieldHash/Changes
index 071dcaa4ff..841bce84d6 100644
--- a/ext/Hash/Util/FieldHash/Changes
+++ b/ext/Hash/Util/FieldHash/Changes
@@ -3,4 +3,5 @@ Revision history for Perl extension Hash::Util::FieldHash.
0.01 Sat Jun 3 16:24:12 2006
- original version; created by h2xs 1.23 with options
-A -g --skip-ppport -nHash::Util::FieldHash
-
+ Fri Jun 23 22:31:59 CEST 2006
+ - accepted as v5.9.4 DEVEL28420
diff --git a/ext/Hash/Util/FieldHash/FieldHash.xs b/ext/Hash/Util/FieldHash/FieldHash.xs
index 5009e3c81e..14e60f15a5 100644
--- a/ext/Hash/Util/FieldHash/FieldHash.xs
+++ b/ext/Hash/Util/FieldHash/FieldHash.xs
@@ -69,7 +69,6 @@ void HUF_add_uvar_magic(
I32 index, /* get/set will see this */
SV* thing /* any associated info */
) {
- MAGIC* mg;
struct ufuncs uf;
uf.uf_val = val;
uf.uf_set = set;
@@ -155,6 +154,13 @@ void HUF_mark_field(SV* trigger, SV* field) {
hv_store_ent(field_tab, field_id, field_ref, 0);
}
+#define HV_FETCH_ISSTORE 0x01
+#define HV_FETCH_ISEXISTS 0x02
+#define HV_FETCH_LVALUE 0x04
+#define HV_FETCH_JUST_SV 0x08
+
+#define HUF_WOULD_CREATE_KEY(x) ((x) != -1 && ((x) & (HV_FETCH_ISSTORE | HV_FETCH_LVALUE)))
+
/* The key exchange function. It communicates with S_hv_magic_uvar_xkey
* in hv.c */
I32 HUF_watch_key(pTHX_ IV action, SV* field) {
@@ -162,9 +168,11 @@ I32 HUF_watch_key(pTHX_ IV action, SV* field) {
SV* keysv = mg->mg_obj;
if (keysv && SvROK(keysv)) {
SV* ob_id = HUF_obj_id(keysv);
- SV* trigger = HUF_get_trigger(keysv, ob_id);
- HUF_mark_field(trigger, field);
mg->mg_obj = ob_id; /* key replacement */
+ if (HUF_WOULD_CREATE_KEY(action)) {
+ SV* trigger = HUF_get_trigger(keysv, ob_id);
+ HUF_mark_field(trigger, field);
+ }
}
return 0;
}
diff --git a/ext/Hash/Util/FieldHash/Makefile.PL b/ext/Hash/Util/FieldHash/Makefile.PL
index 09b8ecc9a1..1803f243f2 100644
--- a/ext/Hash/Util/FieldHash/Makefile.PL
+++ b/ext/Hash/Util/FieldHash/Makefile.PL
@@ -6,15 +6,17 @@ WriteMakefile(
NAME => 'Hash::Util::FieldHash',
VERSION_FROM => 'lib/Hash/Util/FieldHash.pm', # finds $VERSION
PREREQ_PM => {}, # e.g., Module::Name => 1.1
- (grep( /^PERL_CORE=1$/, @ARGV) ? (MAN3PODS => {}) : ()),
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Hash/Util/FieldHash.pm', # retrieve abstract from module
- AUTHOR => 'Anno Siegel <anno@zrz.tu-berlin.de>') : ()),
+ AUTHOR => 'Anno Siegel <anno4000@zrz.tu-berlin.de>') : ()),
LIBS => [''], # e.g., '-lm'
DEFINE => '', # e.g., '-DHAVE_SOMETHING'
- # Insert -I. if you add *.h files later:
+ # Insert -I. if you add *.h files later:
INC => '', # e.g., '-I/usr/include/other'
- # Un-comment this if you add C files to link with later:
+ # Un-comment this if you add C files to link with later:
# OBJECT => '$(O_FILES)', # link all the C files too
- # CCFLAGS => '-Wuninitialized',
+ # Don't manify in core build
+ (grep( /^PERL_CORE=1$/, @ARGV) ?
+ (MAN3PODS => {}) :
+ ()),
);