diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-18 16:52:47 +0000 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-18 16:53:51 +0000 |
commit | 04daafbde36ab696069a9df17ff85629574491c4 (patch) | |
tree | 66bff8def53de1a0f27038d880bd1306dc2ced39 /locfile.h | |
parent | 75421cbfe32ae6428fe08b6ba83f1f7ac0322c33 (diff) |
Add wrappers for malloc/realloc/free. See #43.
Diffstat (limited to 'locfile.h')
-rw-r--r-- | locfile.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -4,6 +4,7 @@ #include <stdio.h> #include <assert.h> #include <stdarg.h> +#include "jv_alloc.h" typedef struct { int start, end; } location; @@ -24,7 +25,7 @@ static void locfile_init(struct locfile* l, const char* data, int length) { for (int i=0; i<length; i++) { if (data[i] == '\n') l->nlines++; } - l->linemap = malloc(sizeof(int) * (l->nlines + 1)); + l->linemap = jv_mem_alloc(sizeof(int) * (l->nlines + 1)); l->linemap[0] = 0; int line = 1; for (int i=0; i<length; i++) { @@ -37,7 +38,7 @@ static void locfile_init(struct locfile* l, const char* data, int length) { } static void locfile_free(struct locfile* l) { - free(l->linemap); + jv_mem_free(l->linemap); } static int locfile_get_line(struct locfile* l, int pos) { |