From: Anno Siegel Date: Mon, 26 Jun 2006 18:05:53 +0000 (+0200) Subject: Re: [PATCH] Hash::Util::FieldHash X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a607227a3e6385121d3bf032568fb6b9c2dd6e68;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] Hash::Util::FieldHash Message-Id: <133195AB-599D-49EC-8CFE-D67299D947EB@mailbox.tu-berlin.de> p4raw-id: //depot/perl@28431 --- diff --git a/ext/Hash/Util/FieldHash/Changes b/ext/Hash/Util/FieldHash/Changes index 071dcaa..841bce8 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 5009e3c..14e60f1 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 09b8ecc..1803f24 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 ') : ()), + AUTHOR => 'Anno Siegel ') : ()), 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 => {}) : + ()), );