[commit: packages/unix] master: Replace `__hsunix_time` wrapper with CApiFFI (44a8b52)

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


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

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

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

commit 44a8b5240a8766f2561f36400713ea524dd745b0
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 17:25:01 2016 +0100

    Replace `__hsunix_time` wrapper with CApiFFI


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

44a8b5240a8766f2561f36400713ea524dd745b0
 System/Posix/{Time.hsc => Time.hs} | 6 +++---
 cbits/HsUnix.c                     | 6 ------
 include/HsUnix.h                   | 3 ---
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/System/Posix/Time.hsc b/System/Posix/Time.hs
similarity index 92%
rename from System/Posix/Time.hsc
rename to 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 *);
 



More information about the ghc-commits mailing list