on master help sign in
#7, avoid camel-case names in the C code
commite06e52477951d1583fec3ec1bddf627c94bbc132 authorNeil Mitchell <ndmitchell@gmail.com> dateThu 15 Dec 2016, 08:23 (10 years ago) parent1fbee22
3 files changed+8−8
cbits/hexml.c+2−2 cbits/hexml.h+2−2 src/Text/XML/Hexml.hs+4−4
cbits/hexml.c+2−2
@@ -188,7 +188,7 @@ attr* hexml_node_attributes(const document* d, const node* n, int* res)
188188}
189189
190190
191−attr* hexml_node_attributeBy(const document* d, const node* n, const char* s, int slen)
191+attr* hexml_node_attribute(const document* d, const node* n, const char* s, int slen)
192192{
193193 if (slen == -1) slen = (int) strlen(s);
194194 const int limit = end(n->attrs);
@@ -202,7 +202,7 @@ attr* hexml_node_attributeBy(const document* d, const node* n, const char* s, in
202202}
203203
204204// Search for given strings within a node
205−node* hexml_node_childBy(const document* d, const node* parent, const node* prev, const char* s, int slen)
205+node* hexml_node_child(const document* d, const node* parent, const node* prev, const char* s, int slen)
206206{
207207 if (slen == -1) slen = (int) strlen(s);
208208 int i = prev == NULL ? parent->nodes.start : (int) (prev + 1 - d->nodes.nodes);
cbits/hexml.h+2−2
@@ -52,5 +52,5 @@ attr* hexml_node_attributes(const document* d, const node* n, int* res);
5252
5353// Search for given strings within a node, note that prev may be NULL
5454// Requires the string passed to document_parse to be valid.
55−node* hexml_node_childBy(const document* d, const node* parent, const node* prev, const char* s, int slen);
56−attr* hexml_node_attributeBy(const document* d, const node* n, const char* s, int slen);
55+node* hexml_node_child(const document* d, const node* parent, const node* prev, const char* s, int slen);
56+attr* hexml_node_attribute(const document* d, const node* n, const char* s, int slen);
src/Text/XML/Hexml.hs+4−4
@@ -55,8 +55,8 @@ foreign import ccall hexml_document_node :: Ptr CDocument -> IO (Ptr CNode)
5555foreign import ccall hexml_node_children :: Ptr CDocument -> Ptr CNode -> Ptr CInt -> IO (Ptr CNode)
5656foreign import ccall hexml_node_attributes :: Ptr CDocument -> Ptr CNode -> Ptr CInt -> IO (Ptr CAttr)
5757
58−foreign import ccall hexml_node_childBy :: Ptr CDocument -> Ptr CNode -> Ptr CNode -> CString -> CInt -> IO (Ptr CNode)
59−foreign import ccall hexml_node_attributeBy :: Ptr CDocument -> Ptr CNode -> CString -> CInt -> IO (Ptr CAttr)
58+foreign import ccall hexml_node_child :: Ptr CDocument -> Ptr CNode -> Ptr CNode -> CString -> CInt -> IO (Ptr CNode)
59+foreign import ccall hexml_node_attribute :: Ptr CDocument -> Ptr CNode -> CString -> CInt -> IO (Ptr CAttr)
6060
6161-- | A node in an XML document, created by 'parse', then calling functions such
6262-- as 'children' on that initial 'Node'.
@@ -175,7 +175,7 @@ childrenBy (Node src doc n) str = go nullPtr
175175 where
176176 go old = unsafePerformIO $ withForeignPtr doc $ \d ->
177177 BS.unsafeUseAsCStringLen str $ \(bs, len) -> do
178− r <- hexml_node_childBy d n old bs $ fromIntegral len
178+ r <- hexml_node_child d n old bs $ fromIntegral len
179179 touchBS src
180180 return $ if r == nullPtr then [] else Node src doc r : go r
181181
@@ -186,7 +186,7 @@ childrenBy (Node src doc n) str = go nullPtr
186186attributeBy :: Node -> BS.ByteString -> Maybe Attribute
187187attributeBy (Node src doc n) str = unsafePerformIO $ withForeignPtr doc $ \d ->
188188 BS.unsafeUseAsCStringLen str $ \(bs, len) -> do
189− r <- hexml_node_attributeBy d n bs $ fromIntegral len
189+ r <- hexml_node_attribute d n bs $ fromIntegral len
190190 touchBS src
191191 return $ if r == nullPtr then Nothing else Just $ attrPeek src doc r
192192