From 715d1a5921a4e3e10220d466c4ee2c1261d28c1e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 5 Nov 2014 09:53:35 -0800 Subject: Removed stack limits in inline parsing. This brings back segfaults, but we're now aiming for a better solution, revising the renderer so it doesn't use recursion, and using a stack approach for nested brackets. Removing these limits will allow us to know when we've got it right. See #166, #187. --- src/cmark.h | 1 - src/inlines.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cmark.h b/src/cmark.h index e34df72..ff2f9a2 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -9,7 +9,6 @@ #define VERSION "0.1" #define CODE_INDENT 4 -#define STACK_LIMIT 1000 struct node_inl { enum { diff --git a/src/inlines.c b/src/inlines.c index 1ab1b29..a43012f 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -416,7 +416,7 @@ static node_inl* handle_strong_emph(subject* subj, unsigned char c, node_inl **l cannotClose: inl_text = make_str(chunk_dup(&subj->input, subj->pos - numdelims, numdelims)); - if (can_open && subj->emphasis_nestlevel < STACK_LIMIT) + if (can_open) { istack = (inline_stack*)malloc(sizeof(inline_stack)); if (istack == NULL) { @@ -617,8 +617,7 @@ static int link_label(subject* subj, chunk *raw_label) advance(subj); // advance past [ unsigned char c; - while ((c = peek_char(subj)) && - (c != ']' || (nestlevel > 0 && nestlevel < STACK_LIMIT))) { + while ((c = peek_char(subj)) && (c != ']' || nestlevel > 0)) { switch (c) { case '`': tmp = handle_backticks(subj); -- cgit v1.2.3