/usr/include/dar/special_alloc.hpp is in libdar-dev 2.4.8-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | /*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2052 Denis Corbin
//
// This program 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 program 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, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// to contact the author : http://dar.linux.free.fr/email.html
/*********************************************************************/
/// \file special_alloc.hpp
/// \brief re-definition of new and delete class operator
/// \ingroup Private
///
/// this is a set of macro that makes the new and delete operator for
/// a class be re-defined in a way that allocation is done in big chunks
/// at the system level, and is split in small requested pieces for a
/// given object allocation. This bring some performance improvment,
/// because a lot a small objects that live and die toghether have to
/// be allocated.
#ifndef SPECIAL_ALLOC_HPP
#define SPECIAL_ALLOC_HPP
#include "/usr/include/dar/libdar_my_config.h"
#include <iostream>
#include <new>
#ifdef LIBDAR_SPECIAL_ALLOC
extern "C"
{
#if LIBDAR_HAS_STDDEF_H
#include <stddef.h>
#else
#if LIBDAR_HAS_STDLIB_H
#include <stdlib.h>
#endif
#endif
} // end extern "C"
/// \addtogroup Private
/// @{
#define USE_SPECIAL_ALLOC(BASE_TYPE) \
void *operator new(size_t taille) { return special_alloc_new(taille); }; \
void *operator new(size_t taille, const std::nothrow_t& nothrow_constant) { return special_alloc_new(taille); }; \
void *operator new(size_t taille, BASE_TYPE * & place) { return (void *) place; }; \
void *operator new(size_t taille, void * & place) { return place; }; \
void operator delete(void *ptr) throw() { special_alloc_delete(ptr); } \
void operator delete(void* ptr, const std::nothrow_t& nothrow_constant) throw() { special_alloc_delete(ptr); }
namespace libdar
{
// this following call is to be used in a
// multi-thread environment and is called from
// libdar global initialization function
// this makes libdar thread-safe if POSIX mutex
// are available
extern void special_alloc_init_for_thread_safe();
extern void *special_alloc_new(size_t taille);
extern void special_alloc_delete(void *ptr);
// this should be called for sanity and control purposes just before ending the program,
// it will report any block still not yet released
extern void special_alloc_garbage_collect(std::ostream & output);
} // end of namespace
#endif
/// @}
#endif
|