Browse Source

dselect: Move C++ support code into its own file

Guillem Jover 7 years ago
parent
commit
2ca60a4d81
4 changed files with 55 additions and 21 deletions
  1. 1 0
      debian/changelog
  2. 1 0
      dselect/Makefile.am
  3. 53 0
      dselect/cxx-support.cc
  4. 0 21
      dselect/main.cc

+ 1 - 0
debian/changelog

@@ -40,6 +40,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     the vsnprintf() call on the emergency buffer truncates the output.
   * Fix free() on uninitialized pointer in error_context_errmsg_format() in
     libdpkg. Regression introduced in dpkg 1.18.7. Closes: #842004
+  * Move C++ support code into its own file.
   * Architecture support:
     - Add support for AIX operating system.
   * Portability:

+ 1 - 0
dselect/Makefile.am

@@ -22,6 +22,7 @@ AM_CXXFLAGS = \
 bin_PROGRAMS = dselect
 
 dselect_SOURCES = \
+	cxx-support.cc \
 	dselect.h \
 	dselect-curses.h \
 	basecmds.cc \

+ 53 - 0
dselect/cxx-support.cc

@@ -0,0 +1,53 @@
+/*
+ * dselect - Debian package maintenance user interface
+ * cxx-support.cc - C++ support code for dselect
+ *
+ * Copyright © 1994-1996 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ * Copyright © 2006-2015 Guillem Jover <guillem@debian.org>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <compat.h>
+
+#include <sys/types.h>
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <dpkg/dpkg.h>
+
+extern void *
+operator new(size_t size) DPKG_ATTR_THROW(std::bad_alloc)
+{
+	void *p;
+
+	p = m_malloc(size);
+	assert(p);
+
+	return p;
+}
+
+extern void
+operator delete(void *p) DPKG_ATTR_NOEXCEPT
+{
+	free(p);
+}
+
+extern void
+operator delete(void *p, size_t size) DPKG_ATTR_NOEXCEPT
+{
+	free(p);
+}

+ 0 - 21
dselect/main.cc

@@ -354,27 +354,6 @@ void cursesoff() {
   cursesareon = false;
 }
 
-extern void *
-operator new(size_t size) DPKG_ATTR_THROW(std::bad_alloc)
-{
-  void *p;
-  p= m_malloc(size);
-  assert(p);
-  return p;
-}
-
-extern void
-operator delete(void *p) DPKG_ATTR_NOEXCEPT
-{
-  free(p);
-}
-
-extern void
-operator delete(void *p, size_t size) DPKG_ATTR_NOEXCEPT
-{
-  free(p);
-}
-
 urqresult urq_list(void) {
   modstatdb_open((modstatdb_rw)(msdbrw_writeifposs |
                                 msdbrw_available_readonly));