hexml 0.3.1 → 0.3.2
raw patch · 6 files changed
+17/−13 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +2/−0
- LICENSE +1/−1
- README.md +2/−0
- hexml.cabal +3/−3
- src/Main.hs +1/−1
- src/Text/XML/Hexml.hs +8/−8
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Hexml +0.3.2+ #10, mark the small fast FFI calls as "unsafe" (up to 10x faster) 0.3.1 #9, don't walk off the end of the character table 0.3
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2016.+Copyright Neil Mitchell 2017. All rights reserved. Redistribution and use in source and binary forms, with or without
README.md view
@@ -9,3 +9,5 @@ The name "hexml" is a combination of "Hex" (a curse) and "XML". The "X" should not be capitalised because the parser is more curse and less XML. Hexml may be suitable if you want to quickly parse XML, from known sources, and a full XML parser has been shown to be a bottleneck. As an alternative to hexml, which supports things like entities but is still pretty fast, see [Pugixml](http://pugixml.org/) (with a [Haskell binding](https://hackage.haskell.org/package/pugixml)).++Hexml is tested with [AFL](http://lcamtuf.coredump.cx/afl/).
hexml.cabal view
@@ -1,19 +1,19 @@ cabal-version: >= 1.18 build-type: Simple name: hexml-version: 0.3.1+version: 0.3.2 license: BSD3 license-file: LICENSE category: XML author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2016+copyright: Neil Mitchell 2017 synopsis: XML subset DOM parser description: An XML DOM-style parser, that only parses a subset of XML, but is designed to be fast. homepage: https://github.com/ndmitchell/hexml#readme bug-reports: https://github.com/ndmitchell/hexml/issues-tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3+tested-with: GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3 extra-doc-files: README.md CHANGES.txt
src/Main.hs view
@@ -22,7 +22,7 @@ main :: IO () main = do- forM_ examples $ \(parses, src) -> do+ forM_ examples $ \(parses, src) -> case parse src of Left err -> when parses $ fail $ "Unexpected parse failure, " ++ show err Right doc -> do
src/Text/XML/Hexml.hs view
@@ -49,14 +49,14 @@ foreign import ccall hexml_document_free :: Ptr CDocument -> IO () foreign import ccall "&hexml_document_free" hexml_document_free_funptr :: FunPtr (Ptr CDocument -> IO ()) foreign import ccall hexml_node_render :: Ptr CDocument -> Ptr CNode -> CString -> CInt -> IO CInt-foreign import ccall hexml_document_error :: Ptr CDocument -> IO CString-foreign import ccall hexml_document_node :: Ptr CDocument -> IO (Ptr CNode)+foreign import ccall unsafe hexml_document_error :: Ptr CDocument -> IO CString+foreign import ccall unsafe hexml_document_node :: Ptr CDocument -> IO (Ptr CNode) -foreign import ccall hexml_node_children :: Ptr CDocument -> Ptr CNode -> Ptr CInt -> IO (Ptr CNode)-foreign import ccall hexml_node_attributes :: Ptr CDocument -> Ptr CNode -> Ptr CInt -> IO (Ptr CAttr)+foreign import ccall unsafe hexml_node_children :: Ptr CDocument -> Ptr CNode -> Ptr CInt -> IO (Ptr CNode)+foreign import ccall unsafe hexml_node_attributes :: Ptr CDocument -> Ptr CNode -> Ptr CInt -> IO (Ptr CAttr) -foreign import ccall hexml_node_child :: Ptr CDocument -> Ptr CNode -> Ptr CNode -> CString -> CInt -> IO (Ptr CNode)-foreign import ccall hexml_node_attribute :: Ptr CDocument -> Ptr CNode -> CString -> CInt -> IO (Ptr CAttr)+foreign import ccall unsafe hexml_node_child :: Ptr CDocument -> Ptr CNode -> Ptr CNode -> CString -> CInt -> IO (Ptr CNode)+foreign import ccall unsafe hexml_node_attribute :: Ptr CDocument -> Ptr CNode -> CString -> CInt -> IO (Ptr CAttr) -- | A node in an XML document, created by 'parse', then calling functions such -- as 'children' on that initial 'Node'.@@ -152,7 +152,7 @@ -- | Get the direct child nodes of this node. children :: Node -> [Node]-children (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> do+children (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> alloca $ \count -> do res <- hexml_node_children d n count count <- fromIntegral <$> peek count@@ -160,7 +160,7 @@ -- | Get the attributes of this node. attributes :: Node -> [Attribute]-attributes (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> do+attributes (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> alloca $ \count -> do res <- hexml_node_attributes d n count count <- fromIntegral <$> peek count