Disk ARchive
2.4.5
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
src
libdar
special_alloc.hpp
Go to the documentation of this file.
1
/*********************************************************************/
2
// dar - disk archive - a backup/restoration program
3
// Copyright (C) 2002-2052 Denis Corbin
4
//
5
// This program is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU General Public License
7
// as published by the Free Software Foundation; either version 2
8
// of the License, or (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
//
19
// to contact the author : http://dar.linux.free.fr/email.html
20
/*********************************************************************/
21
// $Id: special_alloc.hpp,v 1.11.2.2 2012/02/25 14:43:44 edrusb Rel $
22
//
23
/*********************************************************************/
24
35
36
#ifndef SPECIAL_ALLOC_HPP
37
#define SPECIAL_ALLOC_HPP
38
39
#include "../my_config.h"
40
#include <iostream>
41
42
#ifdef LIBDAR_SPECIAL_ALLOC
43
44
extern
"C"
45
{
46
#if HAVE_STDDEF_H
47
#include <stddef.h>
48
#else
49
#if HAVE_STDLIB_H
50
#include <stdlib.h>
51
#endif
52
#endif
53
}
// end extern "C"
54
57
58
#define USE_SPECIAL_ALLOC(BASE_TYPE) \
59
void *operator new(size_t taille) { return special_alloc_new(taille); }; \
60
void *operator new(size_t taille, BASE_TYPE * & place) { return (void *) place; }; \
61
void *operator new(size_t taille, void * & place) { return place; }; \
62
void operator delete(void *ptr) { special_alloc_delete(ptr); }
63
64
namespace
libdar
65
{
66
// this following call is to be used in a
67
// multi-thread environment and is called from
68
// libdar global initialization function
69
// this makes libdar thread-safe if POSIX mutex
70
// are available
71
extern
void
special_alloc_init_for_thread_safe();
72
73
extern
void
*special_alloc_new(
size_t
taille);
74
extern
void
special_alloc_delete(
void
*ptr);
75
76
// this should be called for sanity and control purposes just before ending the program,
77
// it will report any block still not yet released
78
extern
void
special_alloc_garbage_collect(std::ostream & output);
79
80
81
}
// end of namespace
82
83
#endif
84
86
87
#endif
88
Generated on Wed Jun 13 2012 09:36:50 for Disk ARchive by
1.8.1