This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to annotated tag v1.030099_004
in repository libnet-openid-common-perl.

commit 7ccb99669d180bb3ac469b6b767dd1f744dba1e8
Author: Roger Crew <c...@cs.stanford.edu>
Date:   Thu Oct 20 02:29:22 2011 -0700

    fix warning behaviour of timing_indep_eq
    
    so that it warns of uninitialized values exactly when eq does
    and pays attention to the warning environment of the caller
    so that said warnings can be suppressed (as one might need
    to do in, say, a test routine...)
---
 Changes                  |  2 ++
 lib/Net/OpenID/Common.pm |  3 +++
 t/05-eq.t                | 11 ++++++-----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Changes b/Changes
index 9da15e4..9c56977 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@
 
     * Improved HTML head extraction to skip CDATA and comments (Roger Crew)
 
+    * Fixed warning behavior of timing_indep_eq (Roger Crew)
+
 1.030099_003 Jan 01 2011
 
     * Replace URL escaper with calls to URI::Escape (Robert Norris)
diff --git a/lib/Net/OpenID/Common.pm b/lib/Net/OpenID/Common.pm
index a97cb6e..2c4ea9c 100644
--- a/lib/Net/OpenID/Common.pm
+++ b/lib/Net/OpenID/Common.pm
@@ -168,7 +168,10 @@ sub arg2int {
 }
 
 sub timing_indep_eq {
+    no warnings 'uninitialized';
     my ($x, $y)=@_;
+    warnings::warn('uninitialized','Use of uninitialized value in 
timing_indep_eq')
+       if (warnings::enabled('uninitialized') && !(defined($x) && 
defined($y)));
 
     return '' if length($x)!=length($y);
 
diff --git a/t/05-eq.t b/t/05-eq.t
index 7613ffd..71e105f 100644
--- a/t/05-eq.t
+++ b/t/05-eq.t
@@ -37,10 +37,11 @@ compare_comparisons(undef, undef, 'both undef');
 sub compare_comparisons {
     my ($first, $second, $description)=@_;
 
-    # XXX undefs make icky warnings but still need to be tested.
-    # possibly we should make timing_indep_eq produce exactly the same
-    # warnings as eq when faced with undefs, and then we should test
-    # the warnings. that seems like too much effort
+    # XXX may still want to test that the circumstances under
+    # which eq and timing_indep_eq produce warnings are the same
 
-    is( ($first eq $second), OpenID::util::timing_indep_eq($first, $second) , 
$description);
+    no warnings 'uninitialized';
+    is( ($first eq $second),
+        OpenID::util::timing_indep_eq($first, $second),
+        $description);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libnet-openid-common-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to