chore: some cleanup
This commit is contained in:
@@ -44,6 +44,15 @@ void alist_add(array_list *alist, ELEMENT_TYPE entry) {
|
||||
alist->data[alist->length++] = entry;
|
||||
}
|
||||
|
||||
void alist_remove(array_list *alist, int index) {
|
||||
#ifdef ARRAY_LIST_UNORDERED
|
||||
alist->data[index] = alist->data[--alist->length];
|
||||
#else
|
||||
memcpy(&alist->data[index], &alist->data[index + 1], sizeof(ELEMENT_TYPE) * (alist->capacity - index - 1));
|
||||
alist->length--;
|
||||
#endif //ARRAY_LIST_UNORDERED
|
||||
}
|
||||
|
||||
void alist_free(array_list *alist) {
|
||||
free(alist->data);
|
||||
free(alist);
|
||||
|
||||
Reference in New Issue
Block a user