From: Francesco Chemolli Date: Sun, 6 Jun 2021 15:36:45 +0000 (+0000) Subject: Remove custom global new/delete operators (#839) X-Git-Tag: SQUID_6_0_1~326 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f6b193f49769be8bcc7db680b555f15ea6c8ba9;p=thirdparty%2Fsquid.git Remove custom global new/delete operators (#839) These custom operators did not cover all new/delete cases (e.g., array allocations), were not declared according to C++ standards (triggering compiler warnings), and were not enabled in clang builds. These customizations enabled custom OOM handling (for covered cases), but it is not clear whether that feature is desirable overall, and C++ has better ways to implement such handling (i.e. set_new_handler()). These customizations participated in collection of optional statistics (--enable-xmalloc-statistics), but it is not clear whether that feature implementation is good enough, and, even if it is, providing these partial stats does not outweigh recurring customization problems. --- diff --git a/src/Makefile.am b/src/Makefile.am index 3fd067344e..efafea7cb8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -334,7 +334,6 @@ squid_SOURCES = \ SBufStatsAction.h \ SquidMath.cc \ SquidMath.h \ - SquidNew.cc \ StatCounters.cc \ StatCounters.h \ StatHist.cc \ @@ -619,7 +618,6 @@ ufsdump_SOURCES = \ MemBuf.h \ Parsing.h \ RemovalPolicy.cc \ - SquidNew.cc \ tests/stub_StoreMeta.cc \ StoreMetaUnpacker.cc \ String.cc \ diff --git a/src/SquidNew.cc b/src/SquidNew.cc deleted file mode 100644 index cc3dd8f644..0000000000 --- a/src/SquidNew.cc +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 1996-2021 The Squid Software Foundation and contributors - * - * Squid software is distributed under GPLv2+ license and includes - * contributions from numerous individuals and organizations. - * Please see the COPYING and CONTRIBUTORS files for details. - */ - -/* DEBUG: none Memory Allocation */ - -#include "squid.h" - -#if !defined(__clang__) && !defined(__SUNPRO_CC) - -#include - -void *operator new(size_t size) -{ - return xmalloc(size); -} -void operator delete(void *address) -{ - xfree(address); -} - -#endif /* !defined(__clang__) */ - diff --git a/src/icmp/Makefile.am b/src/icmp/Makefile.am index 2ff1e4c4ac..54fdaf6b3b 100644 --- a/src/icmp/Makefile.am +++ b/src/icmp/Makefile.am @@ -39,7 +39,6 @@ COPIED_SOURCE= \ debug.cc \ globals.cc \ SquidConfig.cc \ - SquidNew.cc \ tests/stub_fd.cc \ tests/stub_HelperChildConfig.cc \ tests/stub_libmem.cc \ @@ -96,9 +95,6 @@ time.cc: $(top_srcdir)/src/time.cc SquidConfig.cc: $(top_srcdir)/src/SquidConfig.cc cp $(top_srcdir)/src/SquidConfig.cc $@ -SquidNew.cc: $(top_srcdir)/src/SquidNew.cc - cp $(top_srcdir)/src/SquidNew.cc $@ - tests/stub_HelperChildConfig.cc: $(top_srcdir)/src/tests/stub_HelperChildConfig.cc cp $(top_srcdir)/src/tests/stub_HelperChildConfig.cc $@