From: sof Date: Thu, 30 Apr 1998 19:51:07 +0000 (+0000) Subject: [project @ 1998-04-30 19:51:07 by sof] X-Git-Tag: Approx_2487_patches~744 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ffff0c112f891dabc7399e1fdfe0f53135996157;p=ghc-hetmet.git [project @ 1998-04-30 19:51:07 by sof] tidyup --- diff --git a/ghc/lib/std/Directory.lhs b/ghc/lib/std/Directory.lhs index 778ecad..edd0e7b 100644 --- a/ghc/lib/std/Directory.lhs +++ b/ghc/lib/std/Directory.lhs @@ -337,15 +337,14 @@ The path refers to an existing non-directory object. --getDirectoryContents :: FilePath -> IO [FilePath] getDirectoryContents path = do dir <- _ccall_ openDir__ path - ptr <- _ccall_ malloc (``sizeof(struct dirent**)''::Int) if dir == ``NULL'' then constructErrorAndFail "getDirectoryContents" - else loop dir ptr + else loop dir where - loop :: Addr -> Addr -> IO [String] - loop dir dirent_ptr = do + loop :: Addr -> IO [String] + loop dir = do dirent_ptr <- _ccall_ readDir__ dir - if dirent_ptr == ``NULL'' + if (dirent_ptr::Addr) == ``NULL'' then do return [] else do @@ -355,7 +354,7 @@ getDirectoryContents path = do -- calls to readdir() may overwrite it. len <- _ccall_ strlen str entry <- stToIO (unpackNBytesST str len) - entries <- loop dir dirent_ptr + entries <- loop dir return (entry:entries) \end{code}