chiark / gitweb /
lib/dpkg/tarfn.c: Kludge `tar_header_decode' to handle spurious `errno'.
[dpkg] / dselect / cxx-support.cc
1 /*
2  * dselect - Debian package maintenance user interface
3  * cxx-support.cc - C++ support code for dselect
4  *
5  * Copyright © 1994-1996 Ian Jackson <ijackson@chiark.greenend.org.uk>
6  * Copyright © 2006-2015 Guillem Jover <guillem@debian.org>
7  *
8  * This is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21
22 #include <config.h>
23 #include <compat.h>
24
25 #include <sys/types.h>
26
27 #include <assert.h>
28 #include <stdlib.h>
29 #ifdef HAVE_CXXABI_H
30 #include <cxxabi.h>
31 #endif
32
33 #include <new>
34
35 #include <dpkg/dpkg.h>
36
37 extern void *
38 operator new(size_t size) DPKG_ATTR_THROW(std::bad_alloc)
39 {
40         void *p;
41
42         p = m_malloc(size);
43         assert(p);
44
45         return p;
46 }
47
48 extern void *
49 operator new[](size_t size) DPKG_ATTR_THROW(std::bad_alloc)
50 {
51         void *p;
52
53         p = m_malloc(size);
54         assert(p);
55
56         return p;
57 }
58
59 extern void
60 operator delete(void *p) DPKG_ATTR_NOEXCEPT
61 {
62         free(p);
63 }
64
65 extern void
66 operator delete(void *p, size_t size) DPKG_ATTR_NOEXCEPT
67 {
68         free(p);
69 }
70
71 extern void
72 operator delete[](void *a) DPKG_ATTR_NOEXCEPT
73 {
74         free(a);
75 }
76
77 extern void
78 operator delete[](void *a, size_t size) DPKG_ATTR_NOEXCEPT
79 {
80         free(a);
81 }
82
83 #ifdef HAVE___CXA_PURE_VIRTUAL
84 namespace __cxxabiv1 {
85
86 extern "C" void
87 __cxa_pure_virtual()
88 {
89         internerr("pure virtual function called");
90 }
91
92 }
93 #endif