[project @ 2001-07-31 16:35:29 by simonmar]
authorsimonmar <unknown>
Tue, 31 Jul 2001 16:35:29 +0000 (16:35 +0000)
committersimonmar <unknown>
Tue, 31 Jul 2001 16:35:29 +0000 (16:35 +0000)
use the eqForeignPtr primop

Foreign/ForeignPtr.hs

index dffd225..5a02dca 100644 (file)
@@ -9,7 +9,7 @@
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- $Id: ForeignPtr.hs,v 1.2 2001/07/03 11:37:50 simonmar Exp $
+-- $Id: ForeignPtr.hs,v 1.3 2001/07/31 16:35:29 simonmar Exp $
 --
 -- This module defines foreign pointers, i.e. addresses with associated
 -- finalizers.
@@ -44,12 +44,8 @@ INSTANCE_TYPEABLE1(ForeignPtr,foreignPtrTc,"ForeignPtr")
 data ForeignPtr a = ForeignPtr ForeignObj#
 instance CCallable (ForeignPtr a)
 
-eqForeignPtr :: ForeignPtr a -> ForeignPtr a -> Bool
-eqForeignPtr mp1 mp2
-  = unsafePerformIO (primEqForeignPtr mp1 mp2) /= (0::Int)
-
-foreign import "eqForeignObj" unsafe 
-  primEqForeignPtr :: ForeignPtr a -> ForeignPtr a -> IO Int
+eqForeignPtr  :: ForeignPtr a -> ForeignPtr a -> Bool
+eqForeignPtr (ForeignPtr fo1#) (ForeignPtr fo2#) = eqForeignObj# fo1# fo2#
 
 instance Eq (ForeignPtr a) where 
     p == q = eqForeignPtr p q