[hyena/hyenafied-safeuri] [SafeUri] Avoid casting the same object twice



commit 573802e3e3724e0ca478da07cff84bd981cb2cf1
Author: David Nielsen <gnomeuser gmail com>
Date:   Wed Aug 4 19:39:44 2010 +0200

    [SafeUri] Avoid casting the same object twice
    
    Reported by the AvoidRepetitiveCastsRule Gendarme rule. Fixes
    bgo#625181.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 Hyena/Hyena/SafeUri.cs |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/Hyena/Hyena/SafeUri.cs b/Hyena/Hyena/SafeUri.cs
index a5ff842..a394c78 100644
--- a/Hyena/Hyena/SafeUri.cs
+++ b/Hyena/Hyena/SafeUri.cs
@@ -131,11 +131,12 @@ namespace Hyena
 
         public override bool Equals (object o)
         {
-            if (!(o is SafeUri)) {
-                return false;
+            SafeUri s = o as SafeUri;
+            if (s != null) {
+                return s.AbsoluteUri == AbsoluteUri;
             }
 
-            return (o as SafeUri).AbsoluteUri == AbsoluteUri;
+            return false;
         }
 
         public override int GetHashCode ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]