@@ -130,16 +130,14 @@ nodeChildren (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> do
130 alloca $ \count -> do
130 alloca $ \count -> do
131 res <- node_children d n count
131 res <- node_children d n count
132 count <- fromIntegral <$> peek count
132 count <- fromIntegral <$> peek count
134− return [Node src doc $ plusPtr res $ i*sz | i <- [0..count-1]]
133+ return [Node src doc $ plusPtr res $ i*szNode | i <- [0..count-1]]
136nodeAttributes :: Node -> [Attribute]
135nodeAttributes :: Node -> [Attribute]
137nodeAttributes (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> do
136nodeAttributes (Node src doc n) = unsafePerformIO $ withForeignPtr doc $ \d -> do
138 alloca $ \count -> do
137 alloca $ \count -> do
139 res <- node_attributes d n count
138 res <- node_attributes d n count
140 count <- fromIntegral <$> peek count
139 count <- fromIntegral <$> peek count
142− return [attrPeek src doc (plusPtr res $ i*sz) | i <- [0..count-1]]
140+ return [attrPeek src doc $ plusPtr res $ i*szAttr | i <- [0..count-1]]
144nodeChildrenBy :: Node -> BS.ByteString -> [Node]
142nodeChildrenBy :: Node -> BS.ByteString -> [Node]
145nodeChildrenBy = node_firstChildBy `seq` node_nextChildBy `seq` undefined
143nodeChildrenBy = node_firstChildBy `seq` node_nextChildBy `seq` undefined