cmark

My personal build of CMark ✏️

Commit
ac73c7827650675f4bfe28fdef2a355b9950f2dc
Parent
c6649f58496e4873df5241663502512faa31a11d
Author
John MacFarlane <jgm@MacBook-Pro.local>
Date

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.

Diffstat

1 file changed, 3 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 6 3 3
diff --git 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);