From 184a69171d5d983ee2f08cce28011d235f44cc5c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Mar 2012 01:59:07 -0400 Subject: removed another 10 lines via ifM --- Logs/Presence.hs | 7 +++---- Logs/Remote.hs | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Logs') diff --git a/Logs/Presence.hs b/Logs/Presence.hs index 372af37d5..933426718 100644 --- a/Logs/Presence.hs +++ b/Logs/Presence.hs @@ -99,10 +99,9 @@ type LogMap = M.Map String LogLine {- Inserts a log into a map of logs, if the log has better (ie, newer) - information than the other logs in the map -} mapLog :: LogLine -> LogMap -> LogMap -mapLog l m = - if better - then M.insert i l m - else m +mapLog l m + | better = M.insert i l m + | otherwise = m where better = maybe True newer $ M.lookup i m newer l' = date l' <= date l diff --git a/Logs/Remote.hs b/Logs/Remote.hs index ccfb4bb31..5c9d67df0 100644 --- a/Logs/Remote.hs +++ b/Logs/Remote.hs @@ -72,14 +72,15 @@ configUnEscape = unescape unescape (c:rest) | c == '&' = entity rest | otherwise = c : unescape rest - entity s = if ok - then chr (Prelude.read num) : unescape rest - else '&' : unescape s + entity s + | not (null num) && ";" `isPrefixOf` r = + chr (Prelude.read num) : unescape rest + | otherwise = + '&' : unescape s where num = takeWhile isNumber s r = drop (length num) s rest = drop 1 r - ok = not (null num) && ";" `isPrefixOf` r {- for quickcheck -} prop_idempotent_configEscape :: String -> Bool -- cgit v1.2.3