Commit de0fe30e authored by Philip Pronin's avatar Philip Pronin Committed by Sara Golemon

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
parent 44365277
...@@ -895,13 +895,15 @@ class IOBuf { ...@@ -895,13 +895,15 @@ class IOBuf {
* Throws std::bad_alloc on error. On error the IOBuf chain will be * 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 * unmodified. Throws std::overflow_error if the length of the entire chain
* larger than can be described by a uint32_t capacity. * larger than can be described by a uint32_t capacity.
*
* Returns ByteRange that points to the data IOBuf stores.
*/ */
void coalesce() { ByteRange coalesce() {
if (!isChained()) { if (isChained()) {
return;
}
coalesceSlow(); coalesceSlow();
} }
return ByteRange(data_, length_);
}
/** /**
* Ensure that this chain has at least maxLength bytes available as a * Ensure that this chain has at least maxLength bytes available as a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment