Commit f17f9a9c authored by zhujiashun's avatar zhujiashun

redis_server_protocol: refine code

parent c0aed241
......@@ -457,7 +457,7 @@ void RedisReply::SetStringImpl(const std::string& str, RedisReplyType type) {
LOG(FATAL) << "Fail to allocate string[" << size << "]";
return;
}
memcpy(d, str.c_str(), size);
memcpy(d, str.data(), size);
d[size] = '\0';
_data.long_str = d;
}
......
......@@ -192,9 +192,7 @@ inline RedisReply::RedisReply() {
}
inline bool RedisReply::is_nil() const {
return (_type == REDIS_REPLY_NIL) ||
((_type == REDIS_REPLY_STRING || _type == REDIS_REPLY_ARRAY) &&
_length == npos);
return (_type == REDIS_REPLY_NIL || _length == npos);
}
inline bool RedisReply::is_error() const { return _type == REDIS_REPLY_ERROR; }
inline bool RedisReply::is_integer() const { return _type == REDIS_REPLY_INTEGER; }
......
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