From ac73c7827650675f4bfe28fdef2a355b9950f2dc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 28 Dec 2015 10:18:10 -0800 Subject: Use input not parser->curline to determine last line length. Ultimately I think we can get rid of parser->curline and avoid an unnecessary allocation per line. --- src/blocks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blocks.c b/src/blocks.c index 82edba4..259fa54 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -996,12 +996,12 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, parser->current = container; } finished: - parser->last_line_length = parser->curline->size; + parser->last_line_length = input.len; if (parser->last_line_length && - parser->curline->ptr[parser->last_line_length - 1] == '\n') + input.data[parser->last_line_length - 1] == '\n') parser->last_line_length -= 1; if (parser->last_line_length && - parser->curline->ptr[parser->last_line_length - 1] == '\r') + input.data[parser->last_line_length - 1] == '\r') parser->last_line_length -= 1; cmark_strbuf_clear(parser->curline); -- cgit v1.2.3