Commit c09b5941 authored by sundb's avatar sundb Committed by Madelyn Olson
Browse files

optimization src/adlist.c:listJoin()

parent 19c29b60
...@@ -360,7 +360,8 @@ void listRotateHeadToTail(list *list) { ...@@ -360,7 +360,8 @@ void listRotateHeadToTail(list *list) {
/* Add all the elements of the list 'o' at the end of the /* Add all the elements of the list 'o' at the end of the
* list 'l'. The list 'other' remains empty but otherwise valid. */ * list 'l'. The list 'other' remains empty but otherwise valid. */
void listJoin(list *l, list *o) { void listJoin(list *l, list *o) {
if (o->head) if (o->len == 0) return;
o->head->prev = l->tail; o->head->prev = l->tail;
if (l->tail) if (l->tail)
...@@ -368,7 +369,7 @@ void listJoin(list *l, list *o) { ...@@ -368,7 +369,7 @@ void listJoin(list *l, list *o) {
else else
l->head = o->head; l->head = o->head;
if (o->tail) l->tail = o->tail; l->tail = o->tail;
l->len += o->len; l->len += o->len;
/* Setup other as an empty list. */ /* Setup other as an empty list. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment