Permalink
Browse files

Simplify the equlity check against 0

Replace this with (zero? ...)
  • Loading branch information...
1 parent 3bdf0d3 commit 888a5296952c6cd2edc98162d853c36cdecc2ca1 @KushalP KushalP committed Mar 17, 2012
Showing with 3 additions and 6 deletions.
  1. +3 −6 ring-core/src/ring/middleware/session/cookie.clj
View
9 ring-core/src/ring/middleware/session/cookie.clj
@@ -79,12 +79,9 @@
(defn- secure-compare [^String a ^String b]
(if (and a b (= (.length a) (.length b)))
- (= 0
- (reduce bit-or
- (map bit-xor
- (.getBytes a)
- (.getBytes b))))
- false))
+ (zero? (reduce bit-or
+ (map bit-xor (.getBytes a) (.getBytes b))))
+ false))
(defn- unseal
"Retrieve a sealed Clojure data structure from a string"

0 comments on commit 888a529

Please sign in to comment.