summaryrefslogtreecommitdiff
path: root/src/parser.h
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2016-12-31 02:25:16 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-12-30 18:25:16 -0700
commit4fbe344df43ed7f60a3d3a53981088334cb709fc (patch)
treef7f8264d06cb31024f169fda11c5d72821510c51 /src/parser.h
parentc4c1d59ca29aceb1c5919908ac97d9476264fd96 (diff)
Change types for source map offsets (#174)
* Improve strbuf guarantees Introduce BUFSIZE_MAX macro and make sure that the strbuf implementation can handle strings up to this size. * Abort early if document size exceeds internal limit * Change types for source map offsets Switch to size_t for the public API, making the public headers C89-compatible again. Switch to bufsize_t internally, reducing memory usage and improving performance on 32-bit platforms. * Make parser return NULL on internal index overflow Make S_parser_feed set an error and ignore subsequent chunks if the total input document size exceeds an internal limit. Make cmark_parser_finish return NULL if an error was encountered. Add public API functions to retrieve error code and error message. strbuf overflow in renderers and OOM in parser or renderers still cause an abort.
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h
index b28a8a7..7b4fdbc 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -2,6 +2,7 @@
#define CMARK_AST_H
#include <stdio.h>
+#include "cmark.h"
#include "node.h"
#include "buffer.h"
#include "memory.h"
@@ -18,6 +19,8 @@ struct cmark_parser {
struct cmark_reference_map *refmap;
struct cmark_node *root;
struct cmark_node *current;
+ cmark_err_type error_code;
+ bufsize_t total_bytes;
int line_number;
bufsize_t offset;
bufsize_t column;