Commit 62072424 authored by Tudor Bosman's avatar Tudor Bosman Committed by Jordan DeLong

Add an allocate() member function on IOBufQueue

Summary: Function is documented in the header.

Reviewed By: soren@fb.com

FB internal diff: D494315
parent 8108795d
......@@ -114,6 +114,16 @@ class IOBufQueue {
*/
void postallocate(uint32_t n);
/**
* Obtain a writable block of n contiguous bytes, allocating more space
* if necessary, and mark it as used. The caller can fill it later.
*/
void* allocate(uint32_t n) {
void* p = preallocate(n, n).first;
postallocate(n);
return p;
}
/**
* Split off the first n bytes of the queue into a separate IOBuf chain,
* and transfer ownership of the new chain to the caller. The IOBufQueue
......
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