mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
use skynet malloc api directly
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user