dpkg (1.18.25) stretch; urgency=medium
[dpkg] / dselect / cxx-support.cc
CommitLineData
1479465f
GJ
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
37extern void *
38operator 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
48extern void *
49operator 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
59extern void
60operator delete(void *p) DPKG_ATTR_NOEXCEPT
61{
62 free(p);
63}
64
65extern void
66operator delete(void *p, size_t size) DPKG_ATTR_NOEXCEPT
67{
68 free(p);
69}
70
71extern void
72operator delete[](void *a) DPKG_ATTR_NOEXCEPT
73{
74 free(a);
75}
76
77extern void
78operator delete[](void *a, size_t size) DPKG_ATTR_NOEXCEPT
79{
80 free(a);
81}
82
83#ifdef HAVE___CXA_PURE_VIRTUAL
84namespace __cxxabiv1 {
85
86extern "C" void
87__cxa_pure_virtual()
88{
89 internerr("pure virtual function called");
90}
91
92}
93#endif