Lines Matching refs:ck
53 static void malloc_insert_free_list(malloc_mem_chunk_t *ck);
205 static void malloc_insert_free_list(malloc_mem_chunk_t *ck) in malloc_insert_free_list() argument
209 malloc_free_list = ck; in malloc_insert_free_list()
210 malloc_free_list_end = ck; in malloc_insert_free_list()
211 ck->prev = ck->next = NULL; in malloc_insert_free_list()
220 if ((uint64_t)ptr < (uint64_t)ck) in malloc_insert_free_list()
224 ptr->next = ck; in malloc_insert_free_list()
225 ck->next = NULL; in malloc_insert_free_list()
226 ck->prev = ptr; in malloc_insert_free_list()
227 malloc_free_list_end = ck; in malloc_insert_free_list()
230 else if ((uint64_t)(ptr->next) > (uint64_t)ck) in malloc_insert_free_list()
232 ck->prev = ptr; in malloc_insert_free_list()
233 ck->next = ptr->next; in malloc_insert_free_list()
234 ptr->next = ck; in malloc_insert_free_list()
235 ck->next->prev = ck; in malloc_insert_free_list()
244 malloc_free_list = ck; in malloc_insert_free_list()
245 ck->prev = NULL; in malloc_insert_free_list()
246 ck->next = ptr; in malloc_insert_free_list()
247 ptr->prev = ck; in malloc_insert_free_list()
252 ck->prev = ptr->prev; in malloc_insert_free_list()
253 ck->next = ptr; in malloc_insert_free_list()
254 ck->prev->next = ck; in malloc_insert_free_list()
255 ptr->prev = ck; in malloc_insert_free_list()
282 malloc_mem_chunk_t *ck = malloc_query_free_chunk_bf(size); in malloc() local
284 if (ck == NULL) // 没有空闲块 in malloc()
290 ck = malloc_query_free_chunk_bf(size); in malloc()
293 if (ck) in malloc()
306 ck = malloc_query_free_chunk_bf(size); in malloc()
311 if (ck == NULL) in malloc()
316 if (ck->prev == NULL) // 当前是链表的第一个块 in malloc()
318 malloc_free_list = ck->next; in malloc()
321 ck->prev->next = ck->next; in malloc()
323 if (ck->next != NULL) // 当前不是最后一个块 in malloc()
324 ck->next->prev = ck->prev; in malloc()
326 malloc_free_list_end = ck->prev; in malloc()
329 if ((int64_t)(ck->length) - size > sizeof(malloc_mem_chunk_t)) in malloc()
332 malloc_mem_chunk_t *new_ck = (malloc_mem_chunk_t *)(((uint64_t)ck) + size); in malloc()
333 new_ck->length = ck->length - size; in malloc()
336 ck->length = size; in malloc()
341 return (void *)((uint64_t)ck + sizeof(uint64_t)); in malloc()
381 malloc_mem_chunk_t *ck = (malloc_mem_chunk_t *)((uint64_t)ptr - sizeof(uint64_t)); in free() local
383 count_last_free_size += ck->length; in free()
385 malloc_insert_free_list(ck); in free()