From d81cdc09e9469375d0a0631790d249576010022b Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 26 Sep 2012 19:40:00 +0200 Subject: [PATCH] Move operator new to its own file. --- libmaxsi/Makefile | 1 + libmaxsi/heap.cpp | 6 ------ libmaxsi/op-new.cpp | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 libmaxsi/op-new.cpp diff --git a/libmaxsi/Makefile b/libmaxsi/Makefile index 63204f5d..b5cd8b07 100644 --- a/libmaxsi/Makefile +++ b/libmaxsi/Makefile @@ -75,6 +75,7 @@ heap.o \ integer.o \ mbtowc.o \ memory.o \ +op-new.o \ readparamstring.o \ rewind.o \ sort.o \ diff --git a/libmaxsi/heap.cpp b/libmaxsi/heap.cpp index 1c6cd883..a6031384 100644 --- a/libmaxsi/heap.cpp +++ b/libmaxsi/heap.cpp @@ -728,9 +728,3 @@ namespace Maxsi } } } - -void* operator new(size_t Size) { return malloc(Size); } -void* operator new[](size_t Size) { return malloc(Size); } -void operator delete (void* Addr) { return free(Addr); }; -void operator delete[](void* Addr) { return free(Addr); }; - diff --git a/libmaxsi/op-new.cpp b/libmaxsi/op-new.cpp new file mode 100644 index 00000000..8775f845 --- /dev/null +++ b/libmaxsi/op-new.cpp @@ -0,0 +1,31 @@ +/******************************************************************************* + + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + op-new.cpp + C++ allocation operators. + +*******************************************************************************/ + +#include +#include + +void* operator new(size_t size) { return malloc(size); } +void* operator new[](size_t size) { return malloc(size); } +void operator delete (void* addr) { return free(addr); } +void operator delete[](void* addr) { return free(addr); }