mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
optimization src/adlist.c:listJoin()
This commit is contained in:
parent
19c29b6007
commit
c09b5941ce
@ -360,15 +360,16 @@ void listRotateHeadToTail(list *list) {
|
||||
/* Add all the elements of the list 'o' at the end of the
|
||||
* list 'l'. The list 'other' remains empty but otherwise valid. */
|
||||
void listJoin(list *l, list *o) {
|
||||
if (o->head)
|
||||
o->head->prev = l->tail;
|
||||
if (o->len == 0) return;
|
||||
|
||||
o->head->prev = l->tail;
|
||||
|
||||
if (l->tail)
|
||||
l->tail->next = o->head;
|
||||
else
|
||||
l->head = o->head;
|
||||
|
||||
if (o->tail) l->tail = o->tail;
|
||||
l->tail = o->tail;
|
||||
l->len += o->len;
|
||||
|
||||
/* Setup other as an empty list. */
|
||||
|
Loading…
Reference in New Issue
Block a user