summaryrefslogtreecommitdiff
path: root/src/iterator.c
AgeCommit message (Collapse)Author
2020-01-23Rearrange struct cmark_nodeNick Wellnhofer
Introduce multi-purpose data/len members in struct cmark_node. This is mainly used to store literal text for inlines, code and HTML blocks. Move the content strbuf for blocks from cmark_node to cmark_parser. When finalizing nodes that allow inlines (paragraphs and headings), detach the strbuf and store the block content in the node's data/len members. Free the block content after processing inlines. Reduces size of struct cmark_node by 8 bytes.
2020-01-23Use C string instead of chunk for literal textNick Wellnhofer
Use zero-terminated C strings and a separate length field instead of cmark_chunks. Literal inline text will now be copied from the parent block's content buffer, slowing the benchmark down by 10-15%. The node struct never references memory of other nodes now, fixing #309. Node accessors don't have to check for delayed creation of C strings, so parsing and iterating all literals using the public API should actually be faster than before.
2017-08-09Add sourcepos info for inlinesYuki Izumi
2016-06-06cmark: Implement support for custom allocatorsVicent Marti
2016-06-06cmake: Global handler for OOM situationsVicent Marti
2016-01-17iterator: handle NULL root.John MacFarlane
2015-12-28Rename NODE_HTML -> NODE_HTML_BLOCK, NODE_INLINE_HTML -> NODE_HTML_INLINE.John MacFarlane
API change. Sorry, but this is the time to break things, before 1.0 is released. This matches the recent changes to CommonMark.dtd.
2015-12-22Rename hrule -> thematic_break.John MacFarlane
CMARK_NODE_HRULE -> CMARK_NODE_THEMATIC_BREAK. However we've defined the former as the latter to keep backwards compatibility. See jgm/CommonMark 8fa94cb460f5e516b0e57adca33f50a669d51f6c
2015-08-10Remove need to disable MSVC warning 4800Kevin Wojniak
2015-07-27Use clang-format, llvm style, for formatting.John MacFarlane
* Reformatted all source files. * Added 'format' target to Makefile. * Removed 'astyle' target. * Updated .editorconfig.
2015-05-07cmark_consolidate_text_nodes: Avoid an unnecessary string allocation.John MacFarlane
2015-05-06cmark_consolidate_text_nodes: avoid some unnecessary allocation.John MacFarlane
This improves on #32, I think. @elibarzilay, does this look better? We now avoid the allocations associated with cmark_get_literal, and copy directly from the chunk to the buffer.
2015-05-04Better solution for memory leak in `cmark_consolidate_text_nodes`.John MacFarlane
This avoids allocating a new string. Closes #32.
2015-05-04Straightforward fix for memory leak #32.John MacFarlane
2015-02-15Fixed segfault with --normalize (closes #7).John MacFarlane
This bug was introduced after the modification in 009c3847f004fda437dd5376a9452973b1cb913e.
2015-01-20Accessor for iterator's root nodeNick Wellnhofer
2015-01-12Some astyle reformatting.John MacFarlane
2015-01-10Rework iteratorsNick Wellnhofer
* Advance to the next node when calling 'cmark_iter_next', not when calling 'cmark_iter_get_node'. * Add 'cmark_iter_get_event_type' accessor. * Allow deletion of nodes after an 'EXIT' event, or an 'ENTER' event for leaf nodes.
2015-01-10Optimize S_is_leafNick Wellnhofer
2015-01-09Minor code reformatting.John MacFarlane
2015-01-08Added `cmark_iter_reset` and a note about handling destructive updates.John MacFarlane
2015-01-07cmark: Add function & option to normalize text nodes.John MacFarlane
So, instead of <text>Hi</text> <text>&amp;</text> <text>lo</text> we get <text>Hi&amp;lo</text> * Added exported `cmark_consolidate_text_nodes` function. * Added `CMARK_OPT_NORMALIZE` to options. * Added optional normalization in XML writer. * Added `--normalize` option to command-line program. * Updated man page.
2014-12-14Rename CMARK_NODE_INLINE_CODE -> CMARK_NODE_CODE.John MacFarlane
2014-12-13Added iterator interface to API, removed cmark_walk.John MacFarlane
* Added `iterator.c`, `iterator.h`. * Removed `cmark_walk`. * Replaced `cmark_walk` with iterator in HTML renderer. * Replaced API test for `cmark_walk` with simple iterator test.