]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove custom global new/delete operators (#839)
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 6 Jun 2021 15:36:45 +0000 (15:36 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 11 Jun 2021 01:11:27 +0000 (01:11 +0000)
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.

src/Makefile.am
src/SquidNew.cc [deleted file]
src/icmp/Makefile.am

index 3fd067344eb6aca1c23d82faa70048d8ba6986f8..efafea7cb88168c36e853b70d9e7ab1e70de90e5 100644 (file)
@@ -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 (file)
index cc3dd8f..0000000
+++ /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 <new>
-
-void *operator new(size_t size)
-{
-    return xmalloc(size);
-}
-void operator delete(void *address)
-{
-    xfree(address);
-}
-
-#endif /* !defined(__clang__) */
-
index 2ff1e4c4ac3ec04a8fca4eaa6cf644b419bbe27b..54fdaf6b3bc39fc59947fe47f62fc86de5c07132 100644 (file)
@@ -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 $@