From 6125e10be601e009e43db256cb55b89ddba813ca Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 6 Jun 2014 17:23:58 +0200 Subject: [PATCH] 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. --- repos/base/include/base/allocator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/base/include/base/allocator.h b/repos/base/include/base/allocator.h index db4afd75ee..03a4e67324 100644 --- a/repos/base/include/base/allocator.h +++ b/repos/base/include/base/allocator.h @@ -218,7 +218,7 @@ namespace Genode { * was allocated * \param obj object to destroy */ - template void destroy(DEALLOC dealloc, T *obj); + template 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 -void Genode::destroy(DEALLOC dealloc, T *obj) +void Genode::destroy(DEALLOC && dealloc, T *obj) { if (!obj) return;