[project @ 2001-08-13 10:27:27 by simonmar]
authorsimonmar <unknown>
Mon, 13 Aug 2001 10:27:27 +0000 (10:27 +0000)
committersimonmar <unknown>
Mon, 13 Aug 2001 10:27:27 +0000 (10:27 +0000)
Don't use packString for GHC > 5.00

glafp-utils/nofib-analyse/Printf.lhs

index feeea80..1a8aa4d 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: Printf.lhs,v 1.3 2001/08/07 11:13:46 simonmar Exp $
+-- $Id: Printf.lhs,v 1.4 2001/08/13 10:27:27 simonmar Exp $
 
 -- (c) Simon Marlow 1997-2001
 -----------------------------------------------------------------------------
 
 #else
 
->              allocaBytes bUFSIZE $ \buf -> do
->              snprintf buf (fromIntegral bUFSIZE) (packString format) num
->              peekCString buf
+>              allocaBytes bUFSIZE $ \buf ->
+>                withCString format $ \cformat -> do
+>                  snprintf buf (fromIntegral bUFSIZE) cformat num
+>                  peekCString buf
 
 #endif
 
 > if_maybe Nothing  f = []
 > if_maybe (Just s) f = f s
 
-> type PackedString = ByteArray Int
-
 #if __GLASGOW_HASKELL__ < 500
 
+> type PackedString = ByteArray Int
 > foreign import unsafe snprintf :: Addr -> CSize -> PackedString -> Float -> IO ()
 
 #else
 
-> foreign import unsafe snprintf :: CString -> CSize -> PackedString -> Float -> IO ()
+> foreign import unsafe snprintf :: CString -> CSize -> CString -> Float -> IO ()
 
 #endif