diff options
author | Vicent Marti <tanoku@gmail.com> | 2016-06-06 11:45:47 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-06-06 15:39:06 -0700 |
commit | fc1299a51ede05b3a76ae2f5a3ce882741a43a8b (patch) | |
tree | d8c8de49a2cb7c3bab832556e25f2648a7c6e8d0 /src/blocks.c | |
parent | 27376c2150df53d23995c0360a30152f68af5e7c (diff) |
mem: Add a `realloc` pointer to the memory handler
Diffstat (limited to 'src/blocks.c')
-rw-r--r-- | src/blocks.c | 13 |
1 files changed, 1 insertions, 12 deletions
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); } |