diff options
author | 王卿 <wyuchemtsing@126.com> | 2023-01-21 05:18:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 13:18:52 -0800 |
commit | c95ff0f304bfb8f3228b7af63a0b8d4b9ad36468 (patch) | |
tree | 7bfe5f05bbfd2018a2fe0ff334453ecd6cd674ba /src/adlist.c | |
parent | f3f6f7c0d66f136146a912e06c8fbe31ecfbc977 (diff) | |
download | redis-c95ff0f304bfb8f3228b7af63a0b8d4b9ad36468.tar.gz |
Remove duplicate code in listAddNodeTail (#11733)
Remove duplicate code that removes a node from the tail of a list.
Diffstat (limited to 'src/adlist.c')
-rw-r--r-- | src/adlist.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/adlist.c b/src/adlist.c index 66d31b168..f031c46e8 100644 --- a/src/adlist.c +++ b/src/adlist.c @@ -126,16 +126,7 @@ list *listAddNodeTail(list *list, void *value) if ((node = zmalloc(sizeof(*node))) == NULL) return NULL; node->value = value; - if (list->len == 0) { - 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++; + listLinkNodeTail(list, node); return list; } |