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
7b45bfb2
Commit
7b45bfb2
authored
Mar 25, 2009
by
antirez
Browse files
New protocol fix for LREM
parent
4e405577
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
7b45bfb2
...
...
@@ -215,7 +215,7 @@ typedef struct _redisSortOperation {
struct
sharedObjectsStruct
{
robj
*
crlf
,
*
ok
,
*
err
,
*
emptybulk
,
*
czero
,
*
cone
,
*
pong
,
*
space
,
*
colon
,
*
minus1
,
*
nullbulk
,
*
nullmultibulk
,
*
colon
,
*
nullbulk
,
*
nullmultibulk
,
*
emptymultibulk
,
*
wrongtypeerr
,
*
nokeyerr
,
*
syntaxerr
,
*
sameobjecterr
,
*
outofrangeerr
,
*
plus
,
*
select0
,
*
select1
,
*
select2
,
*
select3
,
*
select4
,
...
...
@@ -667,7 +667,6 @@ static void createSharedObjects(void) {
shared
.
nullmultibulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*-1
\r\n
"
));
shared
.
emptymultibulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*0
\r\n
"
));
/* no such key */
shared
.
minus1
=
createObject
(
REDIS_STRING
,
sdsnew
(
"-1
\r\n
"
));
shared
.
pong
=
createObject
(
REDIS_STRING
,
sdsnew
(
"+PONG
\r\n
"
));
shared
.
wrongtypeerr
=
createObject
(
REDIS_STRING
,
sdsnew
(
"-ERR Operation against a key holding the wrong kind of value
\r\n
"
));
...
...
@@ -1532,13 +1531,19 @@ static int saveDbBackground(char *filename) {
return
REDIS_OK
;
/* unreached */
}
static
int
loadType
(
FILE
*
fp
)
{
uint8_t
type
;
if
(
fread
(
&
type
,
1
,
1
,
fp
)
==
0
)
return
-
1
;
return
type
;
}
static
int
loadDb
(
char
*
filename
)
{
FILE
*
fp
;
char
buf
[
REDIS_LOADBUF_LEN
];
/* Try to use this buffer instead of */
char
vbuf
[
REDIS_LOADBUF_LEN
];
/* malloc() when the element is small */
char
*
key
=
NULL
,
*
val
=
NULL
;
uint32_t
klen
,
vlen
,
dbid
;
u
int
8_t
type
;
int
type
;
int
retval
;
dict
*
d
=
server
.
dict
[
0
];
...
...
@@ -1554,7 +1559,7 @@ static int loadDb(char *filename) {
robj
*
o
;
/* Read type. */
if
(
fread
(
&
type
,
1
,
1
,
fp
)
==
0
)
goto
eoferr
;
if
(
(
type
=
loadType
(
fp
)
)
==
-
1
)
goto
eoferr
;
if
(
type
==
REDIS_EOF
)
break
;
/* Handle SELECT DB opcode as a special case */
if
(
type
==
REDIS_SELECTDB
)
{
...
...
@@ -2280,7 +2285,7 @@ static void lremCommand(redisClient *c) {
de
=
dictFind
(
c
->
dict
,
c
->
argv
[
1
]);
if
(
de
==
NULL
)
{
addReply
(
c
,
shared
.
minus1
);
addReply
(
c
,
shared
.
nokeyerr
);
}
else
{
robj
*
o
=
dictGetEntryVal
(
de
);
...
...
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