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()
179 malloc_mem_chunk_t *ptr = malloc_free_list->next; in malloc_merge_free_chunk() local
180 while (ptr != NULL) in malloc_merge_free_chunk()
183 if (((uint64_t)(ptr->prev) + ptr->prev->length == (uint64_t)ptr)) in malloc_merge_free_chunk()
187 ptr->prev->length += ptr->length; in malloc_merge_free_chunk()
188 ptr->prev->next = ptr->next; in malloc_merge_free_chunk()
189 if (ptr->next == NULL) in malloc_merge_free_chunk()
190 malloc_free_list_end = ptr->prev; in malloc_merge_free_chunk()
192 ptr->next->prev = ptr->prev; in malloc_merge_free_chunk()
194 ptr = ptr->prev; in malloc_merge_free_chunk()
196 ptr = ptr->next; in malloc_merge_free_chunk()
217 malloc_mem_chunk_t *ptr = malloc_free_list; in malloc_insert_free_list() local
218 while (ptr != NULL) in malloc_insert_free_list()
220 if ((uint64_t)ptr < (uint64_t)ck) in malloc_insert_free_list()
222 if (ptr->next == NULL) // 当前是最后一个项 in malloc_insert_free_list()
224 ptr->next = ck; in malloc_insert_free_list()
226 ck->prev = ptr; 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()
242 if (ptr->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()
255 ptr->prev = ck; in malloc_insert_free_list()
259 ptr = ptr->next; in malloc_insert_free_list()
378 void free(void *ptr) in free() argument
381 malloc_mem_chunk_t *ck = (malloc_mem_chunk_t *)((uint64_t)ptr - sizeof(uint64_t)); in free()