Return the maximum available space from IOBufQueue::preallocate
authorAlan Frindell <afrind@fb.com>
Fri, 16 Nov 2012 23:49:56 +0000 (15:49 -0800)
committerJordan DeLong <jdelong@fb.com>
Sun, 16 Dec 2012 22:45:28 +0000 (14:45 -0800)
commit01e1af4ac5b08d57c51a3c647e3b9844458abde8
tree70d087c9dc11d040bd32f42a61c48cc5311dc85e
parent559830c8a51872c237b01021a71998fcadcec665
Return the maximum available space from IOBufQueue::preallocate

Summary: IOBufQueue::preallocate currently takes a min and max size, and will return to the caller a buffer with N writable bytes with min <= N <= max.  This is a bit wasteful, since there may be more than max bytes available at the end if the queue with no extra cost.  Now preallocate will return the full amount of contigious space to the caller, even if it is larger than the requested max.

Test Plan: folly and proxygen unit tests

Reviewed By: simpkins@fb.com

FB internal diff: D633912
folly/experimental/io/IOBufQueue.cpp
folly/experimental/io/IOBufQueue.h
folly/experimental/io/test/IOBufQueueTest.cpp