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
a375b077
Commit
a375b077
authored
Oct 17, 2010
by
Pieter Noordhuis
Browse files
Skip object encoding where it doesn't make sense
parent
19408d83
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
a375b077
...
...
@@ -225,8 +225,11 @@ loaderr:
*----------------------------------------------------------------------------*/
void
configSetCommand
(
redisClient
*
c
)
{
robj
*
o
=
getDecodedObject
(
c
->
argv
[
3
])
;
robj
*
o
;
long
long
ll
;
redisAssert
(
c
->
argv
[
2
]
->
encoding
==
REDIS_ENCODING_RAW
);
redisAssert
(
c
->
argv
[
3
]
->
encoding
==
REDIS_ENCODING_RAW
);
o
=
c
->
argv
[
3
];
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"dbfilename"
))
{
zfree
(
server
.
dbfilename
);
...
...
@@ -273,7 +276,6 @@ void configSetCommand(redisClient *c) {
if
(
startAppendOnly
()
==
REDIS_ERR
)
{
addReplyError
(
c
,
"Unable to turn on AOF. Check server logs."
);
decrRefCount
(
o
);
return
;
}
}
...
...
@@ -315,10 +317,8 @@ void configSetCommand(redisClient *c) {
}
else
{
addReplyErrorFormat
(
c
,
"Unsupported CONFIG parameter: %s"
,
(
char
*
)
c
->
argv
[
2
]
->
ptr
);
decrRefCount
(
o
);
return
;
}
decrRefCount
(
o
);
addReply
(
c
,
shared
.
ok
);
return
;
...
...
@@ -326,14 +326,14 @@ badfmt: /* Bad format errors */
addReplyErrorFormat
(
c
,
"Invalid argument '%s' for CONFIG SET '%s'"
,
(
char
*
)
o
->
ptr
,
(
char
*
)
c
->
argv
[
2
]
->
ptr
);
decrRefCount
(
o
);
}
void
configGetCommand
(
redisClient
*
c
)
{
robj
*
o
=
getDecodedObject
(
c
->
argv
[
2
]
)
;
robj
*
o
=
c
->
argv
[
2
];
void
*
replylen
=
addDeferredMultiBulkLength
(
c
);
char
*
pattern
=
o
->
ptr
;
int
matches
=
0
;
redisAssert
(
o
->
encoding
==
REDIS_ENCODING_RAW
);
if
(
stringmatch
(
pattern
,
"dbfilename"
,
0
))
{
addReplyBulkCString
(
c
,
"dbfilename"
);
...
...
@@ -405,12 +405,10 @@ void configGetCommand(redisClient *c) {
sdsfree
(
buf
);
matches
++
;
}
decrRefCount
(
o
);
setDeferredMultiBulkLength
(
c
,
replylen
,
matches
*
2
);
}
void
configCommand
(
redisClient
*
c
)
{
c
->
argv
[
c
->
argc
-
1
]
=
tryObjectEncoding
(
c
->
argv
[
c
->
argc
-
1
]);
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"set"
))
{
if
(
c
->
argc
!=
4
)
goto
badarity
;
configSetCommand
(
c
);
...
...
src/pubsub.c
View file @
a375b077
...
...
@@ -262,7 +262,6 @@ void punsubscribeCommand(redisClient *c) {
}
void
publishCommand
(
redisClient
*
c
)
{
c
->
argv
[
2
]
=
tryObjectEncoding
(
c
->
argv
[
2
]);
int
receivers
=
pubsubPublishMessage
(
c
->
argv
[
1
],
c
->
argv
[
2
]);
addReplyLongLong
(
c
,
receivers
);
}
src/redis.c
View file @
a375b077
...
...
@@ -1007,7 +1007,6 @@ void pingCommand(redisClient *c) {
}
void
echoCommand
(
redisClient
*
c
)
{
c
->
argv
[
1
]
=
tryObjectEncoding
(
c
->
argv
[
1
]);
addReplyBulk
(
c
,
c
->
argv
[
1
]);
}
...
...
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