Fixing indentation
This commit is contained in:
@@ -33,13 +33,13 @@ list_t *create_list(int elementSize, freeFunction freeFn)
|
|||||||
void delete_list(list_t *list)
|
void delete_list(list_t *list)
|
||||||
{
|
{
|
||||||
listNode *current;
|
listNode *current;
|
||||||
|
|
||||||
while(list->head != NULL) {
|
while(list->head != NULL) {
|
||||||
current = list->head;
|
current = list->head;
|
||||||
list->head = current->next;
|
list->head = current->next;
|
||||||
|
|
||||||
if (list->freeFn) {
|
if (list->freeFn)
|
||||||
list->freeFn(current->data);
|
list->freeFn(current->data);
|
||||||
}
|
|
||||||
|
|
||||||
free(current->data);
|
free(current->data);
|
||||||
free(current);
|
free(current);
|
||||||
@@ -99,18 +99,16 @@ void head_list(list_t *list, void **element, bool removeFromList)
|
|||||||
{
|
{
|
||||||
assert(list->head != NULL);
|
assert(list->head != NULL);
|
||||||
|
|
||||||
listNode *node = list->head;
|
listNode *node = list->head;
|
||||||
|
*element = (void *)malloc(list->elementSize);
|
||||||
*element = (void *)malloc(list->elementSize);
|
|
||||||
memcpy(*element, node->data, list->elementSize);
|
memcpy(*element, node->data, list->elementSize);
|
||||||
|
|
||||||
if(removeFromList) {
|
if(removeFromList) {
|
||||||
list->head = node->next;
|
list->head = node->next;
|
||||||
list->logicalLength--;
|
list->logicalLength--;
|
||||||
|
|
||||||
if (list->freeFn) {
|
if (list->freeFn)
|
||||||
list->freeFn(node->data);
|
list->freeFn(node->data);
|
||||||
}
|
|
||||||
|
|
||||||
free(node->data);
|
free(node->data);
|
||||||
free(node);
|
free(node);
|
||||||
|
|||||||
Reference in New Issue
Block a user