summaryrefslogtreecommitdiffstats
path: root/locfile.h
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-12-18 16:52:47 +0000
committerStephen Dolan <mu@netsoc.tcd.ie>2012-12-18 16:53:51 +0000
commit04daafbde36ab696069a9df17ff85629574491c4 (patch)
tree66bff8def53de1a0f27038d880bd1306dc2ced39 /locfile.h
parent75421cbfe32ae6428fe08b6ba83f1f7ac0322c33 (diff)
Add wrappers for malloc/realloc/free. See #43.
Diffstat (limited to 'locfile.h')
-rw-r--r--locfile.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/locfile.h b/locfile.h
index 77b1aef1..710cfbd1 100644
--- a/locfile.h
+++ b/locfile.h
@@ -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) {