Resize(): Added boolean "force" parameter that allows to force setting the
new memory, even if it isn't needed at that time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35231 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5b45f726d8
commit
5f679d1cd3
@ -255,12 +255,14 @@ public:
|
||||
/*! Resizes the table using the given allocation. The allocation must not
|
||||
be \c NULL. It must be of size \a size, which must a value returned
|
||||
earlier by ResizeNeeded(). If the size requirements have changed in the
|
||||
meantime, the method free()s the given allocation and returns \c false.
|
||||
meantime, the method free()s the given allocation and returns \c false,
|
||||
unless \a force is \c true, in which case the supplied allocation is
|
||||
used in any event.
|
||||
Otherwise \c true is returned.
|
||||
*/
|
||||
bool Resize(void* allocation, size_t size)
|
||||
bool Resize(void* allocation, size_t size, bool force = false)
|
||||
{
|
||||
if (size != ResizeNeeded()) {
|
||||
if (!force && size != ResizeNeeded()) {
|
||||
free(allocation);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user