Tuvie commented on code in PR #2005:
URL: https://github.com/apache/incubator-brpc/pull/2005#discussion_r1028788588


##########
src/butil/iobuf.cpp:
##########
@@ -1219,11 +1227,23 @@ int IOBuf::append_user_data(void* data, size_t size, 
void (*deleter)(void*)) {
         deleter = ::free;
     }
     IOBuf::Block* b = new (mem) IOBuf::Block((char*)data, size, deleter);
+    b->u.data_meta = meta;
     const IOBuf::BlockRef r = { 0, b->cap, b };
     _move_back_ref(r);
     return 0;
 }
 
+uint64_t IOBuf::get_first_data_meta() {
+    if (_ref_num() == 0) {
+        return 0;
+    }
+    IOBuf::BlockRef const& r = _ref_at(0);
+    if (!r.block->flags) {

Review Comment:
   OK



##########
src/butil/iobuf.h:
##########
@@ -246,7 +247,18 @@ friend class IOBufCutter;
     // Append the user-data to back side WITHOUT copying.
     // The user-data can be split and shared by smaller IOBufs and will be
     // deleted using the deleter func when no IOBuf references it anymore.
-    int append_user_data(void* data, size_t size, void (*deleter)(void*));
+    inline int append_user_data(void* data, size_t size, void 
(*deleter)(void*)) {

Review Comment:
   OK



-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to