You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2020/06/01 02:49:47 UTC

[GitHub] [incubator-brpc] zyearn commented on a change in pull request #1128: fix redis args

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org