Lines Matching refs:ck
53 static void malloc_insert_free_list(malloc_mem_chunk_t *ck);
204 static void malloc_insert_free_list(malloc_mem_chunk_t *ck) in malloc_insert_free_list() argument
208 malloc_free_list = ck; in malloc_insert_free_list()
209 malloc_free_list_end = ck; in malloc_insert_free_list()
210 ck->prev = ck->next = NULL; in malloc_insert_free_list()
219 if ((uint64_t)ptr < (uint64_t)ck) in malloc_insert_free_list()
223 ptr->next = ck; in malloc_insert_free_list()
224 ck->next = NULL; in malloc_insert_free_list()
225 ck->prev = ptr; in malloc_insert_free_list()
226 malloc_free_list_end = ck; in malloc_insert_free_list()
229 else if ((uint64_t)(ptr->next) > (uint64_t)ck) in malloc_insert_free_list()
231 ck->prev = ptr; in malloc_insert_free_list()
232 ck->next = ptr->next; in malloc_insert_free_list()
233 ptr->next = ck; in malloc_insert_free_list()
234 ck->next->prev = ck; in malloc_insert_free_list()
243 malloc_free_list = ck; in malloc_insert_free_list()
244 ck->prev = NULL; in malloc_insert_free_list()
245 ck->next = ptr; in malloc_insert_free_list()
246 ptr->prev = ck; in malloc_insert_free_list()
251 ck->prev = ptr->prev; in malloc_insert_free_list()
252 ck->next = ptr; in malloc_insert_free_list()
253 ck->prev->next = ck; in malloc_insert_free_list()
254 ptr->prev = ck; in malloc_insert_free_list()
281 malloc_mem_chunk_t *ck = malloc_query_free_chunk_bf(size); in malloc() local
283 if (ck == NULL) // 没有空闲块 in malloc()
289 ck = malloc_query_free_chunk_bf(size); in malloc()
292 if (ck) in malloc()
305 ck = malloc_query_free_chunk_bf(size); in malloc()
310 if (ck == NULL) in malloc()
315 if (ck->prev == NULL) // 当前是链表的第一个块 in malloc()
317 malloc_free_list = ck->next; in malloc()
320 ck->prev->next = ck->next; in malloc()
322 if (ck->next != NULL) // 当前不是最后一个块 in malloc()
323 ck->next->prev = ck->prev; in malloc()
325 malloc_free_list_end = ck->prev; in malloc()
328 if ((int64_t)(ck->length) - size > sizeof(malloc_mem_chunk_t)) in malloc()
331 malloc_mem_chunk_t *new_ck = (malloc_mem_chunk_t *)(((uint64_t)ck) + size); in malloc()
332 new_ck->length = ck->length - size; in malloc()
335 ck->length = size; in malloc()
340 return (void *)((uint64_t)ck + sizeof(uint64_t)); in malloc()
380 malloc_mem_chunk_t *ck = (malloc_mem_chunk_t *)((uint64_t)ptr - sizeof(uint64_t)); in free() local
382 count_last_free_size += ck->length; in free()
384 malloc_insert_free_list(ck); in free()