Add Buffer::copy_from(GWBUF*)

This makes it easier to create a Buffer from GWBUF that the API functions
pass as arguments.
This commit is contained in:
Markus Mäkelä 2018-04-07 10:15:03 +03:00
parent f06b2b5ab9
commit 23aa9cc492
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -423,9 +423,22 @@ public:
* @see Buffer::operator =
*/
bool copy_from(const Buffer& rhs)
{
return copy_from(rhs.m_pBuffer);
}
/**
* Clone a GWBUF and free the current buffer
*
* @param buf Buffer to clone
*
* @return True if buffer was copied
*
* @attention Invalidates all iterators.
*/
bool copy_from(GWBUF* pBuffer)
{
bool copied = true;
GWBUF* pBuffer = rhs.m_pBuffer;
if (pBuffer)
{