added buffer_get_chunk_tobuf() which copies some chunk from one buffer to the other without a temporary variable

This commit is contained in:
git@daemon.de
2014-02-26 15:27:53 +01:00
parent 0069d6ea29
commit 504ff55a00
3 changed files with 27 additions and 580 deletions

View File

@@ -293,15 +293,25 @@ int buffer_done(Buffer *b);
be 0 in case of errors. See also: fatals_ifany(), buffer_done() and buffer_left().
\param[in] b The Buffer object to read from.
\param[out] buf The destination pointer where the data will be copied to. This pointer
must be allocated by the caller properly and it must have at least a size of len.
\param[in] len The number of bytes to read from the Buffer.
\return Returns the size of bytes read, 0 in case an error occurred.
*/
size_t buffer_get_chunk(Buffer *b, void *buf, size_t len);
/** Read some chunk of data from the Buffer and add to another Buffer.
Works identical to buffer_get_chunk() but copies the requested
chunk directly into the Buffer \a dst, which will be resized
properly if needed.
\param[in] b The Buffer object to read from.
\param[out] dst The Buffer object to write to.
\return Returns the size of bytes read, 0 in case an error occurred.
*/
size_t buffer_get_chunk_tobuf(Buffer *b, Buffer *dst, size_t len);
/** Read the whole Buffer content.
This function returns the whole buffer contents as a pointer