summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@MacBook-Pro.local>2015-12-28 10:18:10 -0800
committerJohn MacFarlane <jgm@MacBook-Pro.local>2015-12-28 10:18:10 -0800
commitac73c7827650675f4bfe28fdef2a355b9950f2dc (patch)
tree76dca373a0bb662a2f53b179a1ea290c58438a11
parentc6649f58496e4873df5241663502512faa31a11d (diff)
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.
-rw-r--r--src/blocks.c6
1 files 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);