use skynet malloc api directly

This commit is contained in:
Cloud Wu
2014-04-22 12:26:08 +08:00
parent 08c511160f
commit 75a28b0fcc
19 changed files with 98 additions and 107 deletions

View File

@@ -29,19 +29,19 @@ hashid_init(struct hashid *hi, int max) {
hi->hashmod = hashcap - 1;
hi->cap = max;
hi->count = 0;
hi->id = malloc(max * sizeof(struct hashid_node));
hi->id = skynet_malloc(max * sizeof(struct hashid_node));
for (i=0;i<max;i++) {
hi->id[i].id = -1;
hi->id[i].next = NULL;
}
hi->hash = malloc(hashcap * sizeof(struct hashid_node *));
hi->hash = skynet_malloc(hashcap * sizeof(struct hashid_node *));
memset(hi->hash, 0, hashcap * sizeof(struct hashid_node *));
}
static void
hashid_clear(struct hashid *hi) {
free(hi->id);
free(hi->hash);
skynet_free(hi->id);
skynet_free(hi->hash);
hi->id = NULL;
hi->hash = NULL;
hi->hashmod = 1;