cmark

My personal build of CMark ✏️

Commit
4dcdc715910b61a2b58f1ea8ae5f86d041e3c229
Parent
c095a0ef0c585dbb64b0ecf8a148a50918f83474
Author
Nick Wellnhofer <wellnhofer@aevum.de>
Date

Don't use variable-length arrays

They're not supported by MSVC.

Diffstat

1 file changed, 4 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/main.c 5 4 1
diff --git a/src/main.c b/src/main.c
@@ -28,13 +28,14 @@ int main(int argc, char *argv[])
 {
 	int i, numfps = 0;
 	bool ast = false;
-	int files[argc];
+	int *files;
 	unsigned char buffer[4096];
 	cmark_doc_parser *parser;
 	size_t offset;
 	node_block *document;
 
 	parser = cmark_new_doc_parser();
+	files = (int *)malloc(argc * sizeof(*files));
 
 	for (i = 1; i < argc; i++) {
 		if (strcmp(argv[i], "--version") == 0) {
@@ -99,5 +100,7 @@ int main(int argc, char *argv[])
 	cmark_free_blocks(document);
 	end_timer("free_blocks");
 
+	free(files);
+
 	return 0;
 }