1 module Sound.EsounD.Internals
9 import Foreign.C.String
10 import Foreign.C.Types
13 import System.Posix.IO
14 import System.Posix.Types
16 wrapSocket :: String -> CInt → IO Handle
17 wrapSocket e (-1) = fail e
18 wrapSocket _ fd = fdToHandle (Fd fd)
20 closeSocket :: Handle → IO ()
21 closeSocket h = do (Fd fd) ← handleToFd h
22 _ ← c'esd_close (fromIntegral fd)
25 withCStrOrNull :: Maybe String → (CString → IO a) → IO a
26 withCStrOrNull Nothing f = f nullPtr
27 withCStrOrNull (Just s) f = withCString s f