version 1.15.8.2, 2013/07/20 18:32:39
|
version 1.16, 2011/02/23 09:41:09
|
|
|
#include <cstring> | #include <cstring> |
#include "Buffer.h" | #include "Buffer.h" |
#include "Pegasus/Common/InternalException.h" | #include "Pegasus/Common/InternalException.h" |
#include "Pegasus/Common/Pegasus_inl.h" |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
static inline BufferRep* _reallocate(BufferRep* rep, Uint32 cap) | static inline BufferRep* _reallocate(BufferRep* rep, Uint32 cap) |
{ | { |
// Allocate an extra byte for null-termination performed by getData(). | // Allocate an extra byte for null-termination performed by getData(). |
rep = (BufferRep*)peg_inln_realloc(rep, sizeof(BufferRep) + cap + 1); |
rep = (BufferRep*)realloc(rep, sizeof(BufferRep) + cap + 1); |
| |
|
if (!rep) |
|
{ |
|
throw PEGASUS_STD(bad_alloc)(); |
|
} |
rep->cap = cap; | rep->cap = cap; |
return rep; | return rep; |
} | } |