[commit: haskeline] master: Use CAString functions to marshal locale names (0adbe57)
Ian Lynagh
igloo at earth.li
Sun Jun 19 18:40:02 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/haskeline
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/0adbe5783d7cd121c314a8a3dd450a250d99b10c
>---------------------------------------------------------------
commit 0adbe5783d7cd121c314a8a3dd450a250d99b10c
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date: Mon Apr 11 21:16:21 2011 +0000
Use CAString functions to marshal locale names
>---------------------------------------------------------------
System/Console/Haskeline/Backend/IConv.hsc | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/System/Console/Haskeline/Backend/IConv.hsc b/System/Console/Haskeline/Backend/IConv.hsc
index 5544143..a217ac4 100644
--- a/System/Console/Haskeline/Backend/IConv.hsc
+++ b/System/Console/Haskeline/Backend/IConv.hsc
@@ -65,8 +65,8 @@ openPartialDecoder codeset = do
foreign import ccall "setlocale" c_setlocale :: CInt -> CString -> IO CString
setLocale :: Maybe String -> IO (Maybe String)
-setLocale oldLocale = (maybeWith withCString) oldLocale $ \loc_p -> do
- c_setlocale (#const LC_CTYPE) loc_p >>= maybePeek peekCString
+setLocale oldLocale = (maybeWith withCAString) oldLocale $ \loc_p -> do
+ c_setlocale (#const LC_CTYPE) loc_p >>= maybePeek peekCAString
-----------------
-- Getting the encoding
@@ -77,7 +77,7 @@ foreign import ccall nl_langinfo :: NLItem -> IO CString
getCodeset :: IO String
getCodeset = do
- str <- nl_langinfo (#const CODESET) >>= peekCString
+ str <- nl_langinfo (#const CODESET) >>= peekCAString
-- check for codesets which may be returned by Solaris, but not understood
-- by GNU iconv.
if str `elem` ["","646"]
@@ -95,8 +95,8 @@ foreign import ccall "h_iconv_open" iconv_open
:: CString -> CString -> IO IConvTPtr
iconvOpen :: String -> String -> IO IConvT
-iconvOpen destName srcName = withCString destName $ \dest ->
- withCString srcName $ \src -> do
+iconvOpen destName srcName = withCAString destName $ \dest ->
+ withCAString srcName $ \src -> do
res <- iconv_open dest src
if res == nullPtr `plusPtr` (-1)
then throwErrno $ "iconvOpen "
More information about the Cvs-libraries
mailing list