Skip to content

Commit

Permalink
renaming new param in list_insert_node to newNode
Browse files Browse the repository at this point in the history
  • Loading branch information
dmercer-google committed Jan 9, 2024
1 parent 7f9d0cb commit 9fb3e42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/utils/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int list_popleft(list_t *list, node_t **node);

void list_remove_node(list_t *list, node_t *node);
int list_remove_nodes(list_t *list, node_t *start, node_t *end);
void list_insert_node(list_t *list, node_t *after, node_t *new);
void list_insert_node(list_t *list, node_t *after, node_t *newNode);
int list_insert_nodes(list_t *list, node_t *after, node_t *start, node_t *end);

/*--- singly-linked list ---*/
Expand Down
12 changes: 6 additions & 6 deletions src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,21 @@ int list_remove_nodes(list_t *list, node_t *start, node_t *end)
return 0;
}

void list_insert_node(list_t *list, node_t *after, node_t *new)
void list_insert_node(list_t *list, node_t *after, node_t *newNode)
{
node_t *next;

if (after == NULL) {
/* insert at head */
next = list->head;
list->head = new;
list->head = newNode;
} else {
next = after->next;
after->next = new;
after->next = newNode;
}
new->prev = after;
new->next = next;
next->prev = new;
newNode->prev = after;
newNode->next = next;
next->prev = newNode;
}

int list_insert_nodes(list_t *list, node_t *after, node_t *start, node_t *end)
Expand Down

0 comments on commit 9fb3e42

Please sign in to comment.