(file) Return to Alloc.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

 1 mike  1.1.2.1 /*
 2               //%2006////////////////////////////////////////////////////////////////////////
 3               //
 4               // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 5               // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 6               // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
 7               // IBM Corp.; EMC Corporation, The Open Group.
 8               // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
 9               // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
10               // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
11               // EMC Corporation; VERITAS Software Corporation; The Open Group.
12               // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
13               // EMC Corporation; Symantec Corporation; The Open Group.
14               //
15               // Permission is hereby granted, free of charge, to any person obtaining a copy
16               // of this software and associated documentation files (the "Software"), to
17               // deal in the Software without restriction, including without limitation the
18               // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
19               // sell copies of the Software, and to permit persons to whom the Software is
20               // furnished to do so, subject to the following conditions:
21               // 
22 mike  1.1.2.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
23               // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
24               // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
25               // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
26               // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27               // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28               // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29               // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30               //
31               //==============================================================================
32               //
33               //%/////////////////////////////////////////////////////////////////////////////
34               */
35               
36               #ifndef _Pegasus_Alloc_h
37               #define _Pegasus_Alloc_h
38               
39               #include <Pegasus/Common/Config.h>
40               #include <Pegasus/Common/Linkage.h>
41               #include <stdlib.h>
42               #include <malloc.h>
43 mike  1.1.2.1 
44               #if defined(__cplusplus)
45               # include <new>
46               
47               extern "C" PEGASUS_COMMON_LINKAGE void* pegasus_malloc(size_t size);
48               extern "C" PEGASUS_COMMON_LINKAGE void (*pegasus_malloc_notifier)(size_t total);
49               extern "C" PEGASUS_COMMON_LINKAGE void* pegasus_realloc(void* ptr, size_t size);
50               extern "C" PEGASUS_COMMON_LINKAGE void pegasus_free(void* ptr);
51               
52               inline void* operator new(size_t size) throw(std::bad_alloc)
53               {
54                   return pegasus_malloc(size);
55               }
56               
57               inline void* operator new[](size_t size) throw(std::bad_alloc)
58               {
59                   return pegasus_malloc(size);
60               }
61               
62               inline void operator delete(void* ptr)
63               {
64 mike  1.1.2.1     pegasus_free(ptr);
65               }
66               
67               inline void operator delete[](void* ptr)
68               {
69                   pegasus_free(ptr);
70               }
71               
72               inline void operator delete(void* ptr, size_t)
73               {
74                   pegasus_free(ptr);
75               }
76               
77               inline void operator delete[](void* ptr, size_t)
78               {
79                   pegasus_free(ptr);
80               }
81               
82               #else /* defined(__cplusplus) */
83               
84               PEGASUS_COMMON_LINKAGE void* pegasus_malloc(size_t size);
85 mike  1.1.2.1 PEGASUS_COMMON_LINKAGE void (*pegasus_malloc_notifier)(size_t total);
86               PEGASUS_COMMON_LINKAGE void* pegasus_realloc(void* ptr, size_t size);
87               PEGASUS_COMMON_LINKAGE void pegasus_free(void* ptr);
88               
89               #endif /* !defined(__cplusplus) */
90               
91               #ifndef PEGASUS_INSIDE_ALLOC_CPP
92               # define malloc pegasus_malloc
93               # define realloc pegasus_realloc
94               # define free pegasus_free
95               #endif
96               
97               #endif /* _Pegasus_Alloc_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2