From fc1299a51ede05b3a76ae2f5a3ce882741a43a8b Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Mon, 6 Jun 2016 11:45:47 +0200 Subject: mem: Add a `realloc` pointer to the memory handler --- src/blocks.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/blocks.c') diff --git a/src/blocks.c b/src/blocks.c index aae81c3..778c330 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -106,19 +106,8 @@ cmark_parser *cmark_parser_new2(int options, cmark_mem *mem) { return parser; } -static void *xcalloc(size_t nmem, size_t size) { - void *ptr = calloc(nmem, size); - if (!ptr) abort(); - return ptr; -} - -static void xfree(void *ptr) { - free(ptr); -} - -cmark_mem DEFAULT_MEM_ALLOCATOR = { xcalloc, xfree }; - cmark_parser *cmark_parser_new(int options) { + extern cmark_mem DEFAULT_MEM_ALLOCATOR; return cmark_parser_new2(options, &DEFAULT_MEM_ALLOCATOR); } -- cgit v1.2.3