[commit: packages/unix] master: Replace `__hsunix_opendir` wrapper with CApiFFI (c41080e)

git at git.haskell.org git at git.haskell.org
Tue Apr 19 21:37:31 UTC 2016


Repository : ssh://git@git.haskell.org/unix

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c41080e2f7802e269a12f6511f1846f4740e5300/unix

>---------------------------------------------------------------

commit c41080e2f7802e269a12f6511f1846f4740e5300
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 17:16:28 2016 +0100

    Replace `__hsunix_opendir` wrapper with CApiFFI


>---------------------------------------------------------------

c41080e2f7802e269a12f6511f1846f4740e5300
 System/Posix/Directory.hsc            | 3 ++-
 System/Posix/Directory/ByteString.hsc | 3 ++-
 cbits/HsUnix.c                        | 6 ------
 include/HsUnix.h                      | 3 ---
 4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc
index 7518b4b..7a3d52a 100644
--- a/System/Posix/Directory.hsc
+++ b/System/Posix/Directory.hsc
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
 {-# LANGUAGE NondecreasingIndentation #-}
 #ifdef __GLASGOW_HASKELL__
 {-# LANGUAGE Trustworthy #-}
@@ -73,7 +74,7 @@ openDirStream name =
     dirp <- throwErrnoPathIfNullRetry "openDirStream" name $ c_opendir s
     return (DirStream dirp)
 
-foreign import ccall unsafe "__hsunix_opendir"
+foreign import capi unsafe "HsUnix.h opendir"
    c_opendir :: CString  -> IO (Ptr CDir)
 
 -- | @readDirStream dp@ calls @readdir@ to obtain the
diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc
index b1db079..b67ad46 100644
--- a/System/Posix/Directory/ByteString.hsc
+++ b/System/Posix/Directory/ByteString.hsc
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
 {-# LANGUAGE NondecreasingIndentation #-}
 #ifdef __GLASGOW_HASKELL__
 {-# LANGUAGE Trustworthy #-}
@@ -74,7 +75,7 @@ openDirStream name =
     dirp <- throwErrnoPathIfNullRetry "openDirStream" name $ c_opendir s
     return (DirStream dirp)
 
-foreign import ccall unsafe "__hsunix_opendir"
+foreign import capi unsafe "HsUnix.h opendir"
    c_opendir :: CString  -> IO (Ptr CDir)
 
 -- | @readDirStream dp@ calls @readdir@ to obtain the
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index 13ca64b..039203e 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -76,12 +76,6 @@ int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
 }
 #endif
 
-// opendir is a macro on some platforms, so we need a wrapper:
-DIR *__hsunix_opendir(const char *filename)
-{
-    return opendir(filename);
-}
-
 // time is a macro on some platforms, so we need a wrapper:
 time_t __hsunix_time(time_t *tloc)
 {
diff --git a/include/HsUnix.h b/include/HsUnix.h
index cfdddb4..72613b6 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -143,9 +143,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
 int __hsunix_nanosleep(const struct timespec *, struct timespec *);
 #endif
 
-// opendir is a macro on some platforms, so we need a wrapper:
-DIR *__hsunix_opendir(const char *);
-
 // time is a macro on some platforms, so we need a wrapper:
 time_t __hsunix_time(time_t *);
 



More information about the ghc-commits mailing list