From: Anno Siegel Date: Tue, 4 Jul 2006 19:42:12 +0000 (+0200) Subject: more warning-silencing in FieldHash X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce809d1f7af78cdf1d563b34bb59d747f8e8945d;p=p5sagit%2Fp5-mst-13.2.git more warning-silencing in FieldHash Message-Id: Date: Tue, 4 Jul 2006 19:42:12 +0200 p4raw-id: //depot/perl@28478 --- diff --git a/ext/Hash/Util/FieldHash/FieldHash.xs b/ext/Hash/Util/FieldHash/FieldHash.xs index 8dadc74..d6ecb80 100644 --- a/ext/Hash/Util/FieldHash/FieldHash.xs +++ b/ext/Hash/Util/FieldHash/FieldHash.xs @@ -46,7 +46,7 @@ SV* HUF_id(SV* ref, NV cookie) { SvNV_set(id, cookie); SvNOK_on(id); } - SvIV_set(id, (IV)SvRV(ref)); + SvIV_set(id, PTR2UV(SvRV(ref))); SvIOK_on(id); return id; } @@ -221,7 +221,7 @@ void HUF_fix_trigger(SV* trigger, SV* new_id) { /* Go over object registry and fix all objects. Also fix the object * registry. */ -void HUF_fix_objects() { +void HUF_fix_objects(void) { dMY_CXT; I32 i, len; HE* ent; diff --git a/ext/Hash/Util/FieldHash/t/02_function.t b/ext/Hash/Util/FieldHash/t/02_function.t index 877d85e..8fed367 100644 --- a/ext/Hash/Util/FieldHash/t/02_function.t +++ b/ext/Hash/Util/FieldHash/t/02_function.t @@ -151,7 +151,7 @@ BEGIN { $n_tests += 8 } { my @refs = map [], 1 .. $size; - $f{ $_} = 1 for @refs; + @f{ @refs } = ( 1) x @refs; is( keys %f, $size, "many keys at once"); is( keys %Hash::Util::FieldHash::ob_reg, diff --git a/ext/Hash/Util/FieldHash/t/05_perlhook.t b/ext/Hash/Util/FieldHash/t/05_perlhook.t index bc9ff95..9901e81 100644 --- a/ext/Hash/Util/FieldHash/t/05_perlhook.t +++ b/ext/Hash/Util/FieldHash/t/05_perlhook.t @@ -118,6 +118,9 @@ use Scalar::Util qw( weaken); () = each %h; is( $counter, 9, "list each doesn't trigger"); + bless \ %h, 'xyz'; + is( $counter, 9, "bless doesn't trigger"); + # see that normal set magic doesn't trigger (identity condition) my %i; Hash::Util::FieldHash::_test_uvar_set( \ %i, \ $counter); @@ -143,7 +146,7 @@ use Scalar::Util qw( weaken); bless \ %i, 'abc'; is( $counter, 1, "...except with bless"); - # see that magic with both set and get doesn't trigger (identity condition) + # see that magic with both set and get doesn't trigger $counter = 123; my %j; Hash::Util::FieldHash::_test_uvar_same( \ %j, \ $counter); @@ -163,13 +166,13 @@ use Scalar::Util qw( weaken); () = values %j; $x = each %j; () = each %j; - - is( $counter, 0, "normal get magic never triggers"); + + is( $counter, 0, "get/set magic never triggers"); bless \ %j, 'abc'; is( $counter, 1, "...except for bless"); - BEGIN { $n_tests += 22 } + BEGIN { $n_tests += 23 } } BEGIN { plan tests => $n_tests }