Scripting: simpler reply buffer creation in luaRedisGenericCommand().
It if faster to just create the string with a single sdsnewlen() call. If c->bufpos is zero, the call will simply be like sdsemtpy().
This commit is contained in:
parent
1c130c6b03
commit
40abeb1f40
@ -306,11 +306,8 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
|
|||||||
/* Convert the result of the Redis command into a suitable Lua type.
|
/* Convert the result of the Redis command into a suitable Lua type.
|
||||||
* The first thing we need is to create a single string from the client
|
* The first thing we need is to create a single string from the client
|
||||||
* output buffers. */
|
* output buffers. */
|
||||||
reply = sdsempty();
|
reply = sdsnewlen(c->buf,c->bufpos);
|
||||||
if (c->bufpos) {
|
c->bufpos = 0;
|
||||||
reply = sdscatlen(reply,c->buf,c->bufpos);
|
|
||||||
c->bufpos = 0;
|
|
||||||
}
|
|
||||||
while(listLength(c->reply)) {
|
while(listLength(c->reply)) {
|
||||||
robj *o = listNodeValue(listFirst(c->reply));
|
robj *o = listNodeValue(listFirst(c->reply));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user