Add wrappers for malloc/realloc/free. See #43.

This commit is contained in:
Stephen Dolan committed 2012-12-18 16:53:51 +00:00
1 parent 75421cbfe3
commit 04daafbde3
15 files changed
+106 -51

No files matched your search

+3 -2
View File
@@ -11,6 +11,7 @@
#include "forkable_stack.h"
#include "frame_layout.h"
#include "jv_alloc.h"
#include "locfile.h"
#include "jv.h"
#include "jv_aux.h"
@@ -33,7 +34,7 @@ int path_push(stackval sv, jv val) {
if (pos == pathsize) {
int oldpathsize = pathsize;
pathsize = oldpathsize ? oldpathsize * 2 : 100;
pathbuf = realloc(pathbuf, sizeof(pathbuf[0]) * pathsize);
pathbuf = jv_mem_realloc(pathbuf, sizeof(pathbuf[0]) * pathsize);
for (int i=oldpathsize; i<pathsize; i++) {
pathbuf[i] = jv_invalid();
}
@@ -491,7 +492,7 @@ void jq_teardown() {
for (int i=0; i<pathsize; i++) {
jv_free(pathbuf[i]);
}
free(pathbuf);
jv_mem_free(pathbuf);
pathbuf = 0;
pathsize = 0;
}