Lines Matching refs:ptr
76 malloc_mem_chunk_t *ptr = malloc_free_list; in malloc_query_free_chunk_bf() local
79 while (ptr != NULL) in malloc_query_free_chunk_bf()
82 if (ptr->length == size) in malloc_query_free_chunk_bf()
84 best = ptr; in malloc_query_free_chunk_bf()
88 if (ptr->length > size) in malloc_query_free_chunk_bf()
91 best = ptr; in malloc_query_free_chunk_bf()
92 else if (best->length > ptr->length) in malloc_query_free_chunk_bf()
93 best = ptr; in malloc_query_free_chunk_bf()
95 ptr = ptr->next; in malloc_query_free_chunk_bf()
111 malloc_mem_chunk_t *ptr = malloc_free_list; in malloc_query_free_chunk_ff() local
113 while (ptr) in malloc_query_free_chunk_ff()
115 if (ptr->length >= size) in malloc_query_free_chunk_ff()
117 return ptr; in malloc_query_free_chunk_ff()
119 ptr = ptr->next; in malloc_query_free_chunk_ff()
178 malloc_mem_chunk_t *ptr = malloc_free_list->next; in malloc_merge_free_chunk() local
179 while (ptr != NULL) in malloc_merge_free_chunk()
182 if (((uint64_t)(ptr->prev) + ptr->prev->length == (uint64_t)ptr)) in malloc_merge_free_chunk()
186 ptr->prev->length += ptr->length; in malloc_merge_free_chunk()
187 ptr->prev->next = ptr->next; in malloc_merge_free_chunk()
188 if (ptr->next == NULL) in malloc_merge_free_chunk()
189 malloc_free_list_end = ptr->prev; in malloc_merge_free_chunk()
191 ptr->next->prev = ptr->prev; in malloc_merge_free_chunk()
193 ptr = ptr->prev; in malloc_merge_free_chunk()
195 ptr = ptr->next; in malloc_merge_free_chunk()
216 malloc_mem_chunk_t *ptr = malloc_free_list; in malloc_insert_free_list() local
217 while (ptr != NULL) in malloc_insert_free_list()
219 if ((uint64_t)ptr < (uint64_t)ck) in malloc_insert_free_list()
221 if (ptr->next == NULL) // 当前是最后一个项 in malloc_insert_free_list()
223 ptr->next = ck; in malloc_insert_free_list()
225 ck->prev = ptr; 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()
241 if (ptr->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()
254 ptr->prev = ck; in malloc_insert_free_list()
258 ptr = ptr->next; in malloc_insert_free_list()
377 void free(void *ptr) in free() argument
380 malloc_mem_chunk_t *ck = (malloc_mem_chunk_t *)((uint64_t)ptr - sizeof(uint64_t)); in free()