Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c09b5941
Commit
c09b5941
authored
Nov 09, 2020
by
sundb
Committed by
Madelyn Olson
Nov 09, 2020
Browse files
optimization src/adlist.c:listJoin()
parent
19c29b60
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/adlist.c
View file @
c09b5941
...
@@ -360,15 +360,16 @@ void listRotateHeadToTail(list *list) {
...
@@ -360,15 +360,16 @@ 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
)
l
->
tail
->
next
=
o
->
head
;
l
->
tail
->
next
=
o
->
head
;
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. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment