Commit da3939ca authored by zhujiashun's avatar zhujiashun

redis_server_protocol: refine code

parent b8c35d85
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
SocketId socket_id; SocketId socket_id;
RedisService* redis_service; RedisService* redis_service;
// If user starts a transaction, handler_continue indicates the // If user starts a transaction, handler_continue indicates the
// handler pointer that runs the transaction handler. // handler pointer that runs the transaction command.
std::unique_ptr<RedisCommandHandler> handler_continue; std::unique_ptr<RedisCommandHandler> handler_continue;
RedisCommandParser parser; RedisCommandParser parser;
......
...@@ -325,7 +325,7 @@ void RedisResponse::MergeFrom(const RedisResponse& from) { ...@@ -325,7 +325,7 @@ void RedisResponse::MergeFrom(const RedisResponse& from) {
RedisReply* new_others = RedisReply* new_others =
(RedisReply*)_arena.allocate(sizeof(RedisReply) * (new_nreply - 1)); (RedisReply*)_arena.allocate(sizeof(RedisReply) * (new_nreply - 1));
for (int i = 0; i < new_nreply - 1; ++i) { for (int i = 0; i < new_nreply - 1; ++i) {
new (new_others + i) RedisReply(NULL); new (new_others + i) RedisReply;
} }
int new_other_index = 0; int new_other_index = 0;
for (int i = 1; i < _nreply; ++i) { for (int i = 1; i < _nreply; ++i) {
...@@ -401,7 +401,7 @@ ParseError RedisResponse::ConsumePartialIOBuf(butil::IOBuf& buf, int reply_count ...@@ -401,7 +401,7 @@ ParseError RedisResponse::ConsumePartialIOBuf(butil::IOBuf& buf, int reply_count
return PARSE_ERROR_ABSOLUTELY_WRONG; return PARSE_ERROR_ABSOLUTELY_WRONG;
} }
for (int i = 0; i < reply_count - 1; ++i) { for (int i = 0; i < reply_count - 1; ++i) {
new (&_other_replies[i]) RedisReply(NULL); new (&_other_replies[i]) RedisReply;
} }
} }
for (int i = reply_size(); i < reply_count; ++i) { for (int i = reply_size(); i < reply_count; ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment