jamesge commented on a change in pull request #972: Redis server protocol
URL: https://github.com/apache/incubator-brpc/pull/972#discussion_r358590090
 
 

 ##########
 File path: src/brpc/redis_reply.h
 ##########
 @@ -137,14 +180,24 @@ inline std::ostream& operator<<(std::ostream& os, const 
RedisReply& r) {
     return os;
 }
 
+inline RedisReply::RedisReply(butil::Arena* arena)
+    : RedisReply() {
+    _arena = arena;
+}
+
 inline RedisReply::RedisReply()
     : _type(REDIS_REPLY_NIL)
-    , _length(0) {
+    , _length(0)
+    , _arena(NULL) {
     _data.array.last_index = -1;
     _data.array.replies = NULL;
 }
 
-inline bool RedisReply::is_nil() const { return _type == REDIS_REPLY_NIL; }
+inline bool RedisReply::is_nil() const {
+    return (_type == REDIS_REPLY_NIL) ||
+        ((_type == REDIS_REPLY_STRING || _type == REDIS_REPLY_ARRAY) &&
+         _length == npos);
 
 Review comment:
   _length==npos能代表下面两种情况么?这种is_xxx有可能到处调用,越简单越好。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to