[commit: packages/unix] master: Replace `__hsunix_getpwent` wrapper with CApiFFI (03783d2)

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


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

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

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

commit 03783d2758d2f35c01a8570da30f508c3b9e019b
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 18:23:15 2016 +0100

    Replace `__hsunix_getpwent` wrapper with CApiFFI


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

03783d2758d2f35c01a8570da30f508c3b9e019b
 System/Posix/User.hsc | 6 +++---
 cbits/HsUnix.c        | 8 --------
 include/HsUnix.h      | 5 -----
 3 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc
index d1a794a..3e11389 100644
--- a/System/Posix/User.hsc
+++ b/System/Posix/User.hsc
@@ -378,11 +378,11 @@ getAllUserEntries =
                      else do thisentry <- unpackUserEntry ppw
                              worker (thisentry : accum)
 
-foreign import ccall unsafe "__hsunix_getpwent"
+foreign import capi unsafe "HsUnix.h getpwent"
   c_getpwent :: IO (Ptr CPasswd)
-foreign import ccall unsafe "setpwent"
+foreign import capi unsafe "HsUnix.h setpwent"
   c_setpwent :: IO ()
-foreign import ccall unsafe "endpwent"
+foreign import capi unsafe "HsUnix.h endpwent"
   c_endpwent :: IO ()
 #else
 getAllUserEntries = error "System.Posix.User.getAllUserEntries: not supported"
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index dc42098..fb63b45 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -16,14 +16,6 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;}
 void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;}
 #endif
 
-#ifdef HAVE_GETPWENT
-// getpwent is a macro on some platforms, so we need a wrapper:
-struct passwd *__hsunix_getpwent(void)
-{
-    return getpwent();
-}
-#endif
-
 #if HAVE_GETPWNAM_R
 // getpwnam_r is a macro on some platforms, so we need a wrapper:
 int __hsunix_getpwnam_r(const char *name, struct passwd *pw, char *buffer,
diff --git a/include/HsUnix.h b/include/HsUnix.h
index 87ac3e6..8b468b7 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -113,11 +113,6 @@ fall back to O_FSYNC, which should be the same */
 # define WCOREDUMP(s) 0
 #endif
 
-#ifdef HAVE_GETPWENT
-// getpwent is a macro on some platforms, so we need a wrapper:
-struct passwd *__hsunix_getpwent(void);
-#endif
-
 #if HAVE_GETPWNAM_R
 // getpwnam_r is a macro on some platforms, so we need a wrapper:
 int __hsunix_getpwnam_r(const char *, struct passwd *, char *, size_t,



More information about the ghc-commits mailing list