mirror of https://mirror.osredm.com/root/redis.git
Remove duplicate code in listAddNodeTail (#11733)
Remove duplicate code that removes a node from the tail of a list.
This commit is contained in:
parent
f3f6f7c0d6
commit
c95ff0f304
11
src/adlist.c
11
src/adlist.c
|
@ -126,16 +126,7 @@ list *listAddNodeTail(list *list, void *value)
|
||||||
if ((node = zmalloc(sizeof(*node))) == NULL)
|
if ((node = zmalloc(sizeof(*node))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
node->value = value;
|
node->value = value;
|
||||||
if (list->len == 0) {
|
listLinkNodeTail(list, node);
|
||||||
list->head = list->tail = node;
|
|
||||||
node->prev = node->next = NULL;
|
|
||||||
} else {
|
|
||||||
node->prev = list->tail;
|
|
||||||
node->next = NULL;
|
|
||||||
list->tail->next = node;
|
|
||||||
list->tail = node;
|
|
||||||
}
|
|
||||||
list->len++;
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue