ngx-export 0.7.0.0 → 0.7.0.1
raw patch · 2 files changed
+21/−18 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- NgxExport.hs +20/−17
- ngx-export.cabal +1/−1
NgxExport.hs view
@@ -362,6 +362,11 @@ pokeCStringLen x l p pl return 1 +safeYYHandler :: IO (L.ByteString, CUInt) -> IO (L.ByteString, CUInt)+safeYYHandler = handle $ \e ->+ return (C8L.pack $ show (e :: SomeException), 1)+{-# INLINE safeYYHandler #-}+ sS :: SS -> CString -> CInt -> Ptr CString -> Ptr CInt -> IO CUInt sS f x (I n) p pl =@@ -394,8 +399,8 @@ Ptr (Ptr NgxStrType) -> Ptr CInt -> Ptr (StablePtr L.ByteString) -> IO CUInt yY f x (I n) p pl spd = do- (s, r) <- (flip (,) 0 . f <$> B.unsafePackCStringLen (x, n))- `catch` \e -> return (C8L.pack $ show (e :: SomeException), 1)+ (s, r) <- safeYYHandler $+ flip (,) 0 . f <$> B.unsafePackCStringLen (x, n) pokeLazyByteString s p pl spd return r @@ -403,10 +408,9 @@ Ptr (Ptr NgxStrType) -> Ptr CInt -> Ptr (StablePtr L.ByteString) -> IO CUInt ioyY f x (I n) p pl spd = do- (s, r) <- (do- s <- B.unsafePackCStringLen (x, n) >>= flip f False- fmap (flip (,) 0) $ return $! s- ) `catch` \e -> return (C8L.pack $ show (e :: SomeException), 1)+ (s, r) <- safeYYHandler $ do+ s <- B.unsafePackCStringLen (x, n) >>= flip f False+ fmap (flip (,) 0) $ return $! s pokeLazyByteString s p pl spd return r @@ -419,16 +423,17 @@ asyncIOCommon :: IO C8L.ByteString -> CInt -> Bool -> Ptr (Ptr NgxStrType) -> Ptr CInt -> Ptr CUInt -> Ptr (StablePtr L.ByteString) -> IO ()-asyncIOCommon a (I fd) efd p pl r spd = void . async $ do- (do {s <- a; fmap Right $ return $! s})- `catch` (\e -> return $ Left $ show (e :: SomeException)) >>=- either (pokeAll 1 . C8L.pack) (pokeAll 0)+asyncIOCommon a (I fd) efd p pl pr spd = void . async $ do+ (s, r) <- safeYYHandler $ do+ s <- a+ fmap (flip (,) 0) $ return $! s+ pokeLazyByteString s p pl spd+ poke pr r uninterruptibleMask_ $ if efd then writeFlag8b else writeFlag1b >> closeFd fd `catchIOError` const (return ())- where pokeAll e s = pokeLazyByteString s p pl spd >> poke r e- writeBufN n s w+ where writeBufN n s w | w < n = (w +) <$> fdWriteBuf fd (plusPtr s $ fromIntegral w) (n - w) `catchIOError`@@ -499,11 +504,9 @@ handler f x (I n) p pl pct plct pst spd = safeHandler pct pst $ do (s, ct, I st) <- f <$> B.unsafePackCStringLen (x, n)- PtrLen t l <- peek p >>= toBuffers s- when (l /= 1) (poke p t) >> poke pl l PtrLen sct lct <- newCStringLen ct pokeCStringLen sct lct pct plct >> poke pst st- when (t /= nullPtr) $ newStablePtr s >>= poke spd+ pokeLazyByteString s p pl spd return 0 defHandler :: YY -> CString -> CInt ->@@ -520,10 +523,10 @@ unsafeHandler f x (I n) p pl pct plct pst = safeHandler pct pst $ do (s, ct, I st) <- f <$> B.unsafePackCStringLen (x, n)- PtrLen t l <- B.unsafeUseAsCStringLen s return- pokeCStringLen t l p pl PtrLen sct lct <- B.unsafeUseAsCStringLen ct return pokeCStringLen sct lct pct plct >> poke pst st+ PtrLen t l <- B.unsafeUseAsCStringLen s return+ pokeCStringLen t l p pl return 0 foreign export ccall ngxExportReleaseLockedByteString ::
ngx-export.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-version: 0.7.0.0+version: 0.7.0.1 synopsis: Helper module for Nginx haskell module description: Helper module for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>