Sierra Toolkit Version of the Day
allocator_eastl.cpp
00001 /*
00002 Copyright (C) 2009-2010 Electronic Arts, Inc.  All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions
00006 are met:
00007 
00008 1.  Redistributions of source code must retain the above copyright
00009     notice, this list of conditions and the following disclaimer.
00010 2.  Redistributions in binary form must reproduce the above copyright
00011     notice, this list of conditions and the following disclaimer in the
00012     documentation and/or other materials provided with the distribution.
00013 3.  Neither the name of Electronic Arts, Inc. ("EA") nor the names of
00014     its contributors may be used to endorse or promote products derived
00015     from this software without specific prior written permission.
00016 
00017 THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY
00018 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
00021 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 */
00028 
00030 // EASTL/allocator.cpp
00031 //
00032 // Copyright (c) 2005, Electronic Arts. All rights reserved.
00033 // Written and maintained by Paul Pedriana.
00035 
00036 
00037 #include <stk_util/util/config_eastl.h>
00038 #include <stk_util/util/allocator_eastl.h>
00039 
00040 
00042 // ReadMe
00043 //
00044 // This file implements the default application allocator.
00045 // You can replace this allocator.cpp file with a different one,
00046 // you can define EASTL_USER_DEFINED_ALLOCATOR below to ignore this file,
00047 // or you can modify the EASTL config.h file to redefine how allocators work.
00049 
00050 
00051 #ifndef EASTL_USER_DEFINED_ALLOCATOR // If the user hasn't declared that he has defined an allocator implementation elsewhere...
00052 
00053     namespace eastl
00054     {
00055 
00058         EASTL_API allocator   gDefaultAllocator;
00059         EASTL_API allocator* gpDefaultAllocator = &gDefaultAllocator;
00060 
00061         EASTL_API allocator* GetDefaultAllocator()
00062         {
00063             return gpDefaultAllocator;
00064         }
00065 
00066         EASTL_API allocator* SetDefaultAllocator(allocator* pAllocator)
00067         {
00068             allocator* const pPrevAllocator = gpDefaultAllocator;
00069             gpDefaultAllocator = pAllocator;
00070             return pPrevAllocator;
00071         }
00072 
00073     } // namespace eastl
00074 
00075 
00076 #endif // EASTL_USER_DEFINED_ALLOCATOR
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines