Lines Matching full:entry

58   AllocationEntry *const entry  in tracking_malloc()  local
61 if (entry == NULL) { in tracking_malloc()
65 entry->num_bytes = size; in tracking_malloc()
66 entry->allocation = malloc(size); in tracking_malloc()
67 if (entry->allocation == NULL) { in tracking_malloc()
68 free(entry); in tracking_malloc()
71 entry->next = NULL; in tracking_malloc()
75 entry->prev = NULL; in tracking_malloc()
76 alloc_head = alloc_tail = entry; in tracking_malloc()
78 entry->prev = alloc_tail; in tracking_malloc()
79 alloc_tail->next = entry; in tracking_malloc()
80 alloc_tail = entry; in tracking_malloc()
83 return entry->allocation; in tracking_malloc()
88 AllocationEntry *entry; in find_allocation() local
90 for (entry = alloc_head; entry != NULL; entry = entry->next) { in find_allocation()
91 if (entry->allocation == ptr) { in find_allocation()
92 return entry; in find_allocation()
101 AllocationEntry *entry; in tracking_free() local
104 /* There won't be an entry for this */ in tracking_free()
108 entry = find_allocation(ptr); in tracking_free()
109 if (entry != NULL) { in tracking_free()
111 if (entry->prev != NULL) in tracking_free()
112 entry->prev->next = entry->next; in tracking_free()
114 alloc_head = entry->next; in tracking_free()
115 if (entry->next != NULL) in tracking_free()
116 entry->next->prev = entry->prev; in tracking_free()
118 alloc_tail = entry->next; in tracking_free()
119 free(entry); in tracking_free()
129 AllocationEntry *entry; in tracking_realloc() local
141 /* Find the allocation entry for this memory */ in tracking_realloc()
142 entry = find_allocation(ptr); in tracking_realloc()
143 if (entry == NULL) { in tracking_realloc()
145 entry = (AllocationEntry *)malloc(sizeof(AllocationEntry)); in tracking_realloc()
146 if (entry == NULL) { in tracking_realloc()
150 entry->allocation = realloc(ptr, size); in tracking_realloc()
151 if (entry->allocation == NULL) { in tracking_realloc()
152 free(entry); in tracking_realloc()
157 entry->next = NULL; in tracking_realloc()
159 entry->prev = NULL; in tracking_realloc()
160 alloc_head = alloc_tail = entry; in tracking_realloc()
162 entry->prev = alloc_tail; in tracking_realloc()
163 alloc_tail->next = entry; in tracking_realloc()
164 alloc_tail = entry; in tracking_realloc()
171 entry->allocation = reallocated; in tracking_realloc()
174 entry->num_bytes = size; in tracking_realloc()
175 return entry->allocation; in tracking_realloc()
180 AllocationEntry *entry; in tracking_report() local
186 for (entry = alloc_head; entry != NULL; entry = entry->next) { in tracking_report()
187 printf("Allocated %lu bytes at %p\n", (long unsigned)entry->num_bytes, in tracking_report()
188 entry->allocation); in tracking_report()