forked from cory/tildefriends
Use a custom allocator for everything.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3892 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
#include "serialize.h"
|
||||
|
||||
#include "mem.h"
|
||||
#include "task.h"
|
||||
#include "taskstub.js.h"
|
||||
#include "util.js.h"
|
||||
@ -53,7 +55,7 @@ void tf_serialize_store(tf_task_t* task, tf_taskstub_t* to, void** out_buffer, s
|
||||
{
|
||||
buffer_t tmp = { 0 };
|
||||
_serialize_store(task, to, &tmp, value);
|
||||
tmp.data = realloc(tmp.data, tmp.size);
|
||||
tmp.data = tf_realloc(tmp.data, tmp.size);
|
||||
*out_buffer = tmp.data;
|
||||
*out_size = tmp.size;
|
||||
}
|
||||
@ -68,7 +70,7 @@ static void _buffer_append(buffer_t* buffer, const void* data, size_t size)
|
||||
if (buffer->capacity < buffer->size + size)
|
||||
{
|
||||
size_t new_capacity = (size + buffer->capacity) * 2;
|
||||
buffer->data = realloc(buffer->data, new_capacity);
|
||||
buffer->data = tf_realloc(buffer->data, new_capacity);
|
||||
buffer->capacity = new_capacity;
|
||||
}
|
||||
memcpy((char*)buffer->data + buffer->size, data, size);
|
||||
|
Reference in New Issue
Block a user