From: Simon Marlow Date: Mon, 19 Apr 2010 13:53:33 +0000 (+0000) Subject: INLINE alloca and malloc X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=6e35f00bffc31587583cfbcf97521c02f40d1f52;p=ghc-base.git INLINE alloca and malloc See discussion on glasgow-haskell-users: http://www.haskell.org/pipermail/glasgow-haskell-users/2010-April/018740.html --- 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