Allow capacity and length to be different for user buffers
authorAbhijeet Joglekar <abhijeet@fb.com>
Wed, 1 Aug 2012 17:36:14 +0000 (10:36 -0700)
committerJordan DeLong <jdelong@fb.com>
Thu, 2 Aug 2012 08:55:51 +0000 (01:55 -0700)
commit00616345649f48bcd2739af8aaa8d18cf174d20b
tree0f407af8f9ecc1abddfc9a9a3dd826699a6c6636
parentbc46f015ee17b1c8fb00a546aff8fd0e80b029e4
Allow capacity and length to be different for user buffers

Summary:
Currently, takeOwnership lets a user pass in a data buffer and wraps it in an
IOBuffer. However, the capacity and length of the user buffer are required to
be same.

Added a new API to allow buffers where the capacity and length can be different.

Users of existing API should not be affected.

Test Plan:
1) Added new test case to IOBufTest that checks buffers with length
different from capacity
2) Run existing IOBuf test cases to verify no regressions

Reviewed By: brianp@fb.com

FB internal diff: D536575
folly/experimental/io/IOBuf.cpp
folly/experimental/io/IOBuf.h
folly/experimental/io/test/IOBufTest.cpp