Add placement new and new[] function.
Signed-off-by: dingxintong <dingddding@163.com>
This commit is contained in:
parent
8e4397968c
commit
c618d0447b
@ -88,3 +88,18 @@ FAR void *operator new(std::size_t nbytes)
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
FAR void *operator new(std::size_t nbytes, FAR void *ptr)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_DEBUG_ERROR
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
_err("ERROR: Failed to placement new\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Return the ptr pointer
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@ -96,3 +96,18 @@ FAR void *operator new[](std::size_t nbytes)
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
FAR void *operator new[](std::size_t nbytes, FAR void *ptr)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_DEBUG_ERROR
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
_err("ERROR: Failed to placement new[]\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Return the ptr pointer
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user