mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
base: Never copy the dealloc argument for destroy
By using &&, we prevent the accidental copying of deallocator instances, passed to the destroy function. We always want to take the deallocator as reference or pointer.
This commit is contained in:
parent
4672ae637a
commit
6125e10be6
@ -218,7 +218,7 @@ namespace Genode {
|
||||
* was allocated
|
||||
* \param obj object to destroy
|
||||
*/
|
||||
template <typename T, typename DEALLOC> void destroy(DEALLOC dealloc, T *obj);
|
||||
template <typename T, typename DEALLOC> void destroy(DEALLOC && dealloc, T *obj);
|
||||
}
|
||||
|
||||
void *operator new (Genode::size_t, Genode::Allocator *);
|
||||
@ -259,7 +259,7 @@ void operator delete (void *, Genode::Deallocator &);
|
||||
|
||||
/* implemented here as it needs the special delete operators */
|
||||
template <typename T, typename DEALLOC>
|
||||
void Genode::destroy(DEALLOC dealloc, T *obj)
|
||||
void Genode::destroy(DEALLOC && dealloc, T *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user