diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-01-30 17:25:01 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2016-01-30 17:28:30 +0100 |
commit | 44a8b5240a8766f2561f36400713ea524dd745b0 (patch) | |
tree | ea13e66e626841575f67353eb36782a03b9755fd | |
parent | c41080e2f7802e269a12f6511f1846f4740e5300 (diff) |
Replace `__hsunix_time` wrapper with CApiFFI
-rw-r--r-- | System/Posix/Time.hs (renamed from System/Posix/Time.hsc) | 6 | ||||
-rw-r--r-- | cbits/HsUnix.c | 6 | ||||
-rw-r--r-- | include/HsUnix.h | 3 |
3 files changed, 3 insertions, 12 deletions
diff --git a/System/Posix/Time.hsc b/System/Posix/Time.hs index a28050d..7a2232f 100644 --- a/System/Posix/Time.hsc +++ b/System/Posix/Time.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CApiFFI #-} +{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #elif __GLASGOW_HASKELL__ >= 703 @@ -23,8 +25,6 @@ module System.Posix.Time ( -- how much already supported by System.Time? ) where -#include "HsUnix.h" - import System.Posix.Types import Foreign import Foreign.C @@ -37,5 +37,5 @@ import Foreign.C epochTime :: IO EpochTime epochTime = throwErrnoIfMinus1 "epochTime" (c_time nullPtr) -foreign import ccall unsafe "__hsunix_time" +foreign import capi unsafe "HsUnix.h time" c_time :: Ptr CTime -> IO CTime diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 039203e..e61f835 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -76,12 +76,6 @@ int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp) } #endif -// time is a macro on some platforms, so we need a wrapper: -time_t __hsunix_time(time_t *tloc) -{ - return time(tloc); -} - // times is a macro on some platforms, so we need a wrapper: clock_t __hsunix_times(struct tms *tp) { diff --git a/include/HsUnix.h b/include/HsUnix.h index 72613b6..62d0f31 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 -// time is a macro on some platforms, so we need a wrapper: -time_t __hsunix_time(time_t *); - // times is a macro on some platforms, so we need a wrapper: clock_t __hsunix_times(struct tms *); |