Copilot commented on code in PR #3649:
URL: https://github.com/apache/brpc/pull/3649#discussion_r4361966831
##########
src/brpc/policy/baidu_rpc_protocol.cpp:
##########
@@ -1047,7 +1047,7 @@ void ProcessRpcResponse(InputMessageBase* msg_base) {
&cntl->response_attachment() : nullptr;
if (cntl->response()->GetDescriptor() ==
SerializedResponse::descriptor()) {
((SerializedResponse*)cntl->response())->
- serialized_data().append(*res_buf_ptr);
+ serialized_data().append(res_buf_ptr->movable());
Review Comment:
`movable()` makes this append *consume* `*res_buf_ptr` (leaving it
empty/invalid-for-assumptions). To prevent future regressions (e.g., someone
later reading `res_buf_ptr->size()` or reusing the buffer after this branch),
add an explicit comment that `res_buf_ptr` is intentionally consumed here, or
refactor to make consumption obvious (e.g., move into a local named variable
before appending). This keeps the performance win while making the ownership
transfer unambiguous.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]