From: Philip Pronin Date: Thu, 10 Oct 2013 19:12:36 +0000 (-0700) Subject: make IOBuf::coalesce return ByteRange X-Git-Tag: v0.22.0~829 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=de0fe30ec67f09ae0870cb8a390a330c1dbb0de5;p=folly.git make IOBuf::coalesce return ByteRange Test Plan: fbconfig -r folly/io && fbmake opt -j32 && fbmake runtests_opt @override-unit-failures Reviewed By: soren@fb.com FB internal diff: D1005735 --- diff --git a/folly/io/IOBuf.h b/folly/io/IOBuf.h index 7d96e02f..a071ba33 100644 --- a/folly/io/IOBuf.h +++ b/folly/io/IOBuf.h @@ -895,12 +895,14 @@ class IOBuf { * Throws std::bad_alloc on error. On error the IOBuf chain will be * unmodified. Throws std::overflow_error if the length of the entire chain * larger than can be described by a uint32_t capacity. + * + * Returns ByteRange that points to the data IOBuf stores. */ - void coalesce() { - if (!isChained()) { - return; + ByteRange coalesce() { + if (isChained()) { + coalesceSlow(); } - coalesceSlow(); + return ByteRange(data_, length_); } /**