From 6e35f00bffc31587583cfbcf97521c02f40d1f52 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Mon, 19 Apr 2010 13:53:33 +0000 Subject: [PATCH] INLINE alloca and malloc See discussion on glasgow-haskell-users: http://www.haskell.org/pipermail/glasgow-haskell-users/2010-April/018740.html --- Foreign/Marshal/Alloc.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Foreign/Marshal/Alloc.hs b/Foreign/Marshal/Alloc.hs index 108058a..c0dfb43 100644 --- a/Foreign/Marshal/Alloc.hs +++ b/Foreign/Marshal/Alloc.hs @@ -70,6 +70,7 @@ import Hugs.ForeignPtr ( FinalizerPtr ) -- The memory may be deallocated using 'free' or 'finalizerFree' when -- no longer required. -- +{-# INLINE malloc #-} malloc :: Storable a => IO (Ptr a) malloc = doMalloc undefined where @@ -93,6 +94,7 @@ mallocBytes size = failWhenNULL "malloc" (_malloc (fromIntegral size)) -- The memory is freed when @f@ terminates (either normally or via an -- exception), so the pointer passed to @f@ must /not/ be used after this. -- +{-# INLINE alloca #-} alloca :: Storable a => (Ptr a -> IO b) -> IO b alloca = doAlloca undefined where -- 1.7.10.4