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
3c08fdae
Commit
3c08fdae
authored
Jan 31, 2012
by
antirez
Browse files
64 bit instances are no longer limited to have at max 2^32-1 elements in lists.
parent
fc4ed429
Changes
5
Show whitespace changes
Inline
Side-by-side
src/adlist.c
View file @
3c08fdae
...
@@ -57,7 +57,7 @@ list *listCreate(void)
...
@@ -57,7 +57,7 @@ list *listCreate(void)
* This function can't fail. */
* This function can't fail. */
void
listRelease
(
list
*
list
)
void
listRelease
(
list
*
list
)
{
{
unsigned
int
len
;
unsigned
long
len
;
listNode
*
current
,
*
next
;
listNode
*
current
,
*
next
;
current
=
list
->
head
;
current
=
list
->
head
;
...
@@ -310,7 +310,7 @@ listNode *listSearchKey(list *list, void *key)
...
@@ -310,7 +310,7 @@ listNode *listSearchKey(list *list, void *key)
* and so on. Negative integers are used in order to count
* and so on. Negative integers are used in order to count
* from the tail, -1 is the last element, -2 the penultimante
* from the tail, -1 is the last element, -2 the penultimante
* and so on. If the index is out of range NULL is returned. */
* and so on. If the index is out of range NULL is returned. */
listNode
*
listIndex
(
list
*
list
,
int
index
)
{
listNode
*
listIndex
(
list
*
list
,
long
index
)
{
listNode
*
n
;
listNode
*
n
;
if
(
index
<
0
)
{
if
(
index
<
0
)
{
...
...
src/adlist.h
View file @
3c08fdae
...
@@ -50,7 +50,7 @@ typedef struct list {
...
@@ -50,7 +50,7 @@ typedef struct list {
void
*
(
*
dup
)(
void
*
ptr
);
void
*
(
*
dup
)(
void
*
ptr
);
void
(
*
free
)(
void
*
ptr
);
void
(
*
free
)(
void
*
ptr
);
int
(
*
match
)(
void
*
ptr
,
void
*
key
);
int
(
*
match
)(
void
*
ptr
,
void
*
key
);
unsigned
int
len
;
unsigned
long
len
;
}
list
;
}
list
;
/* Functions implemented as macros */
/* Functions implemented as macros */
...
@@ -81,7 +81,7 @@ listNode *listNext(listIter *iter);
...
@@ -81,7 +81,7 @@ listNode *listNext(listIter *iter);
void
listReleaseIterator
(
listIter
*
iter
);
void
listReleaseIterator
(
listIter
*
iter
);
list
*
listDup
(
list
*
orig
);
list
*
listDup
(
list
*
orig
);
listNode
*
listSearchKey
(
list
*
list
,
void
*
key
);
listNode
*
listSearchKey
(
list
*
list
,
void
*
key
);
listNode
*
listIndex
(
list
*
list
,
int
index
);
listNode
*
listIndex
(
list
*
list
,
long
index
);
void
listRewind
(
list
*
list
,
listIter
*
li
);
void
listRewind
(
list
*
list
,
listIter
*
li
);
void
listRewindTail
(
list
*
list
,
listIter
*
li
);
void
listRewindTail
(
list
*
list
,
listIter
*
li
);
...
...
src/redis.c
View file @
3c08fdae
...
@@ -1465,7 +1465,7 @@ sds genRedisInfoString(char *section) {
...
@@ -1465,7 +1465,7 @@ sds genRedisInfoString(char *section) {
if
(
sections
++
)
info
=
sdscat
(
info
,
"
\r\n
"
);
if
(
sections
++
)
info
=
sdscat
(
info
,
"
\r\n
"
);
info
=
sdscatprintf
(
info
,
info
=
sdscatprintf
(
info
,
"# Clients
\r\n
"
"# Clients
\r\n
"
"connected_clients:%
d
\r\n
"
"connected_clients:%
lu
\r\n
"
"client_longest_output_list:%lu
\r\n
"
"client_longest_output_list:%lu
\r\n
"
"client_biggest_input_buf:%lu
\r\n
"
"client_biggest_input_buf:%lu
\r\n
"
"blocked_clients:%d
\r\n
"
,
"blocked_clients:%d
\r\n
"
,
...
@@ -1580,7 +1580,7 @@ sds genRedisInfoString(char *section) {
...
@@ -1580,7 +1580,7 @@ sds genRedisInfoString(char *section) {
"keyspace_hits:%lld
\r\n
"
"keyspace_hits:%lld
\r\n
"
"keyspace_misses:%lld
\r\n
"
"keyspace_misses:%lld
\r\n
"
"pubsub_channels:%ld
\r\n
"
"pubsub_channels:%ld
\r\n
"
"pubsub_patterns:%u
\r\n
"
"pubsub_patterns:%
l
u
\r\n
"
"latest_fork_usec:%lld
\r\n
"
,
"latest_fork_usec:%lld
\r\n
"
,
server
.
stat_numconnections
,
server
.
stat_numconnections
,
server
.
stat_numcommands
,
server
.
stat_numcommands
,
...
@@ -1633,7 +1633,7 @@ sds genRedisInfoString(char *section) {
...
@@ -1633,7 +1633,7 @@ sds genRedisInfoString(char *section) {
}
}
}
}
info
=
sdscatprintf
(
info
,
info
=
sdscatprintf
(
info
,
"connected_slaves:%
d
\r\n
"
,
"connected_slaves:%
lu
\r\n
"
,
listLength
(
server
.
slaves
));
listLength
(
server
.
slaves
));
if
(
listLength
(
server
.
slaves
))
{
if
(
listLength
(
server
.
slaves
))
{
int
slaveid
=
0
;
int
slaveid
=
0
;
...
...
src/redis.h
View file @
3c08fdae
...
@@ -823,7 +823,7 @@ void listTypeTryConversion(robj *subject, robj *value);
...
@@ -823,7 +823,7 @@ void listTypeTryConversion(robj *subject, robj *value);
void
listTypePush
(
robj
*
subject
,
robj
*
value
,
int
where
);
void
listTypePush
(
robj
*
subject
,
robj
*
value
,
int
where
);
robj
*
listTypePop
(
robj
*
subject
,
int
where
);
robj
*
listTypePop
(
robj
*
subject
,
int
where
);
unsigned
long
listTypeLength
(
robj
*
subject
);
unsigned
long
listTypeLength
(
robj
*
subject
);
listTypeIterator
*
listTypeInitIterator
(
robj
*
subject
,
int
index
,
unsigned
char
direction
);
listTypeIterator
*
listTypeInitIterator
(
robj
*
subject
,
long
index
,
unsigned
char
direction
);
void
listTypeReleaseIterator
(
listTypeIterator
*
li
);
void
listTypeReleaseIterator
(
listTypeIterator
*
li
);
int
listTypeNext
(
listTypeIterator
*
li
,
listTypeEntry
*
entry
);
int
listTypeNext
(
listTypeIterator
*
li
,
listTypeEntry
*
entry
);
robj
*
listTypeGet
(
listTypeEntry
*
entry
);
robj
*
listTypeGet
(
listTypeEntry
*
entry
);
...
...
src/t_list.c
View file @
3c08fdae
...
@@ -86,7 +86,7 @@ unsigned long listTypeLength(robj *subject) {
...
@@ -86,7 +86,7 @@ unsigned long listTypeLength(robj *subject) {
}
}
/* Initialize an iterator at the specified index. */
/* Initialize an iterator at the specified index. */
listTypeIterator
*
listTypeInitIterator
(
robj
*
subject
,
int
index
,
unsigned
char
direction
)
{
listTypeIterator
*
listTypeInitIterator
(
robj
*
subject
,
long
index
,
unsigned
char
direction
)
{
listTypeIterator
*
li
=
zmalloc
(
sizeof
(
listTypeIterator
));
listTypeIterator
*
li
=
zmalloc
(
sizeof
(
listTypeIterator
));
li
->
subject
=
subject
;
li
->
subject
=
subject
;
li
->
encoding
=
subject
->
encoding
;
li
->
encoding
=
subject
->
encoding
;
...
@@ -484,10 +484,7 @@ void rpopCommand(redisClient *c) {
...
@@ -484,10 +484,7 @@ void rpopCommand(redisClient *c) {
void
lrangeCommand
(
redisClient
*
c
)
{
void
lrangeCommand
(
redisClient
*
c
)
{
robj
*
o
;
robj
*
o
;
long
start
;
long
start
,
end
,
llen
,
rangelen
;
long
end
;
int
llen
;
int
rangelen
;
if
((
getLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
start
,
NULL
)
!=
REDIS_OK
)
||
if
((
getLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
start
,
NULL
)
!=
REDIS_OK
)
||
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
3
],
&
end
,
NULL
)
!=
REDIS_OK
))
return
;
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
3
],
&
end
,
NULL
)
!=
REDIS_OK
))
return
;
...
@@ -546,10 +543,7 @@ void lrangeCommand(redisClient *c) {
...
@@ -546,10 +543,7 @@ void lrangeCommand(redisClient *c) {
void
ltrimCommand
(
redisClient
*
c
)
{
void
ltrimCommand
(
redisClient
*
c
)
{
robj
*
o
;
robj
*
o
;
long
start
;
long
start
,
end
,
llen
,
j
,
ltrim
,
rtrim
;
long
end
;
int
llen
;
int
j
,
ltrim
,
rtrim
;
list
*
list
;
list
*
list
;
listNode
*
ln
;
listNode
*
ln
;
...
@@ -604,7 +598,7 @@ void lremCommand(redisClient *c) {
...
@@ -604,7 +598,7 @@ void lremCommand(redisClient *c) {
robj
*
subject
,
*
obj
;
robj
*
subject
,
*
obj
;
obj
=
c
->
argv
[
3
]
=
tryObjectEncoding
(
c
->
argv
[
3
]);
obj
=
c
->
argv
[
3
]
=
tryObjectEncoding
(
c
->
argv
[
3
]);
long
toremove
;
long
toremove
;
int
removed
=
0
;
long
removed
=
0
;
listTypeEntry
entry
;
listTypeEntry
entry
;
if
((
getLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
toremove
,
NULL
)
!=
REDIS_OK
))
if
((
getLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
toremove
,
NULL
)
!=
REDIS_OK
))
...
...
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