summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/IO/Encoding/Iconv.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-04-13 13:43:39 +0000
committerIan Lynagh <igloo@earth.li>2010-04-13 13:43:39 +0000
commita414415fb3bd772b274857ab35def68571421f0d (patch)
treef98fff2e9c3a8b2b5da791c9bead2b26d3a541bc /libraries/base/GHC/IO/Encoding/Iconv.hs
parentd5dff95d3be1769f3ad1ec95b78cafc3e11ea1b7 (diff)
downloadhaskell-a414415fb3bd772b274857ab35def68571421f0d.tar.gz
Fix bitrot in IO debugging code
Also switched to using Haskell Bools (rather than CPP) to en/disable it, so it shouldn't break again in the future.
Diffstat (limited to 'libraries/base/GHC/IO/Encoding/Iconv.hs')
-rw-r--r--libraries/base/GHC/IO/Encoding/Iconv.hs24
1 files changed, 8 insertions, 16 deletions
diff --git a/libraries/base/GHC/IO/Encoding/Iconv.hs b/libraries/base/GHC/IO/Encoding/Iconv.hs
index 8ef87c936f..4de9cfe0cb 100644
--- a/libraries/base/GHC/IO/Encoding/Iconv.hs
+++ b/libraries/base/GHC/IO/Encoding/Iconv.hs
@@ -30,8 +30,6 @@ module GHC.IO.Encoding.Iconv (
#if !defined(mingw32_HOST_OS)
-#undef DEBUG_DUMP
-
import Foreign
import Foreign.C
import Data.Maybe
@@ -41,27 +39,21 @@ import GHC.IO.Encoding.Types
import GHC.Num
import GHC.Show
import GHC.Real
-#ifdef DEBUG_DUMP
import System.Posix.Internals
-#endif
-iconv_trace :: String -> IO ()
+c_DEBUG_DUMP :: Bool
+c_DEBUG_DUMP = False
-#ifdef DEBUG_DUMP
-
-iconv_trace s = puts s
+iconv_trace :: String -> IO ()
+iconv_trace s
+ | c_DEBUG_DUMP = puts s
+ | otherwise = return ()
puts :: String -> IO ()
-puts s = do withCStringLen (s++"\n") $ \(p, len) ->
- c_write 1 (castPtr p) (fromIntegral len)
+puts s = do _ <- withCStringLen (s ++ "\n") $ \(p, len) ->
+ c_write 1 (castPtr p) (fromIntegral len)
return ()
-#else
-
-iconv_trace _ = return ()
-
-#endif
-
-- -----------------------------------------------------------------------------
-- iconv encoders/decoders