Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv28720/port/src/Port
Modified Files:
Types.hs
Log Message:
Use safe peekCString
Index: Types.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Types.hs,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Types.hs 15 Mar 2003 01:06:32 -0000 1.14
--- Types.hs 26 Mar 2003 18:11:31 -0000 1.15
***************
*** 1054,1058 ****
peekCStrings :: CString -> IO [String]
peekCStrings cstrs
! = do str <- peekCString cstrs
if (null str)
then return []
--- 1054,1060 ----
peekCStrings :: CString -> IO [String]
peekCStrings cstrs
! | ptr == nullPtr = return []
! | otherwise = do
! str <- peekCString cstrs
if (null str)
then return []
***************
*** 1063,1067 ****
resultCString :: IO CString -> IO String
resultCString io
! = bracket io free peekCString
-- | Convert and free a c-string of c-strings.
--- 1065,1072 ----
resultCString :: IO CString -> IO String
resultCString io
! = bracket io free safePeekCString
! where
! safePeekCString ptr | ptr == nullPtr = ""
! | otherwise = peekCString ptr
-- | Convert and free a c-string of c-strings.
|