提交 73989307 编写于 作者: A antirez

Use precomptued objects for bulk and mbulk prefixes.

上级 c06de115
...@@ -474,7 +474,10 @@ void addReplyLongLong(redisClient *c, long long ll) { ...@@ -474,7 +474,10 @@ void addReplyLongLong(redisClient *c, long long ll) {
} }
void addReplyMultiBulkLen(redisClient *c, long length) { void addReplyMultiBulkLen(redisClient *c, long length) {
addReplyLongLongWithPrefix(c,length,'*'); if (length < REDIS_SHARED_BULKHDR_LEN)
addReply(c,shared.mbulkhdr[length]);
else
addReplyLongLongWithPrefix(c,length,'*');
} }
/* Create the length prefix of a bulk reply, example: $2234 */ /* Create the length prefix of a bulk reply, example: $2234 */
...@@ -496,7 +499,11 @@ void addReplyBulkLen(redisClient *c, robj *obj) { ...@@ -496,7 +499,11 @@ void addReplyBulkLen(redisClient *c, robj *obj) {
len++; len++;
} }
} }
addReplyLongLongWithPrefix(c,len,'$');
if (len < REDIS_SHARED_BULKHDR_LEN)
addReply(c,shared.bulkhdr[len]);
else
addReplyLongLongWithPrefix(c,len,'$');
} }
/* Add a Redis Object as a bulk reply */ /* Add a Redis Object as a bulk reply */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册