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,5 +1,6 @@
|
||||
#include "ssb.import.h"
|
||||
|
||||
#include "mem.h"
|
||||
#include "ssb.db.h"
|
||||
#include "ssb.h"
|
||||
|
||||
@ -26,7 +27,7 @@ static void _tf_ssb_import_file_close(uv_fs_t* req)
|
||||
tf_import_file_t* file = req->data;
|
||||
(*file->work_left)--;
|
||||
uv_fs_req_cleanup(req);
|
||||
free(req->data);
|
||||
tf_free(req->data);
|
||||
}
|
||||
|
||||
static void _tf_ssb_import_add_app(tf_ssb_t* ssb, const char* user, const char* app)
|
||||
@ -127,7 +128,7 @@ static void _tf_ssb_import_scandir(uv_fs_t* req)
|
||||
while (uv_fs_scandir_next(req, &ent) == 0)
|
||||
{
|
||||
size_t len = strlen(import->parent) + strlen(ent.name) + 2;
|
||||
char* path = malloc(len);
|
||||
char* path = tf_malloc(len);
|
||||
snprintf(path, len, "%s/%s", import->parent, ent.name);
|
||||
if (ent.type == UV_DIRENT_DIR)
|
||||
{
|
||||
@ -136,7 +137,7 @@ static void _tf_ssb_import_scandir(uv_fs_t* req)
|
||||
else
|
||||
{
|
||||
size_t size = sizeof(tf_import_file_t) + strlen(import->parent) +1 + strlen(ent.name) + 1;
|
||||
tf_import_file_t* file = malloc(size);
|
||||
tf_import_file_t* file = tf_malloc(size);
|
||||
memset(file, 0, size);
|
||||
file->ssb = import->ssb;
|
||||
file->user = import->user;
|
||||
@ -152,11 +153,11 @@ static void _tf_ssb_import_scandir(uv_fs_t* req)
|
||||
if (r < 0)
|
||||
{
|
||||
printf("Failed to open %s: %s.\n", path, uv_strerror(r));
|
||||
free(file);
|
||||
tf_free(file);
|
||||
import->work_left--;
|
||||
}
|
||||
}
|
||||
free(path);
|
||||
tf_free(path);
|
||||
}
|
||||
import->work_left--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user