zyearn commented on a change in pull request #1128:
URL: https://github.com/apache/incubator-brpc/pull/1128#discussion_r433021045
##########
File path: example/redis_c++/redis_server.cpp
##########
@@ -64,9 +64,13 @@ class GetCommandHandler : public brpc::RedisCommandHandler {
explicit GetCommandHandler(RedisServiceImpl* rsimpl)
: _rsimpl(rsimpl) {}
- brpc::RedisCommandHandlerResult Run(const std::vector<const char*>& args,
- brpc::RedisReply* output,
- bool /*flush_batched*/) override {
+ brpc::RedisCommandHandlerResult Run(const std::vector<butil::StringPiece>&
args_piece,
+ brpc::RedisReply* output,
+ bool flush_batched) override {
+ std::vector<std::string> args;
+ for (size_t i = 0; i < args_piece.size(); ++i) {
+ args.emplace_back(args_piece[i].data(), args_piece.size());
+ }
Review comment:
好的,主要是因为example是大家都会复制粘贴的,所以里面的代码尽量要做到efficient & readable.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]