on master help sign in
Tidy up the documentation in hexml.h
commit2c3712446f12ccdafe976e2773ee1ce9c1e24d00 authorNeil Mitchell <ndmitchell@gmail.com> dateWed 30 Nov 2016, 19:08 (10 years ago) parent9ada065
1 file changed+8−5
cbits/hexml.h+8−5
cbits/hexml.h+8−5
@@ -28,20 +28,22 @@ typedef struct
2828// Convention: if slen can be -1 for nul-terminated, or given explicitly
2929
3030// Parse a document, returns a potentially invalid document - use document_error to check
31−// Must use document_free to release the memory.
31+// Must use document_free to release the memory (even if invalid).
32+// The string must be nul terminated, e.g. slen != -1 ==> slen[0]
3233document* document_parse(char* s, int slen);
3334
3435// Free the memory returned from document_parse.
3536void document_free(document* d);
3637
37−// generate a fresh string with the same semantics as the node
38−// requires an input buffer, returns the size of the rendered document
38+// Generate a fresh string with the same semantics as the node.
39+// Requires an input buffer, returns the size of the rendered document.
40+// Requires the string passed to document_parse to be valid.
3941int node_render(document* d, node* n, char* buffer, int length);
4042
41−// return either NULL (successful parse) or the error message
43+// Return either NULL (successful parse) or the error message.
4244char* document_error(document* d);
4345
44−// return the root node of the document - imagine the document is wrapped in <>$DOC</> tags
46+// Return the root node of the document - imagine the document is wrapped in <>$DOC</> tags.
4547node* document_node(document* d);
4648
4749// List all items within a node
@@ -49,5 +51,6 @@ node* node_children(document* d, node* n, int* res);
4951attr* node_attributes(document* d, node* n, int* res);
5052
5153// Search for given strings within a node, note that prev may be NULL
54+// Requires the string passed to document_parse to be valid.
5255node* node_childBy(document* d, node* parent, node* prev, char* s, int slen);
5356attr* node_attributeBy(document* d, node* n, char* s, int slen);