diff --git a/dtool/src/dtoolbase/dallocator.T b/dtool/src/dtoolbase/dallocator.T index 7c6236ec0d..11cd4f51b6 100644 --- a/dtool/src/dtoolbase/dallocator.T +++ b/dtool/src/dtoolbase/dallocator.T @@ -1,52 +1,52 @@ -// Filename: dallocator.T -// Created by: drose (05Jun01) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifdef GCC_STYLE_ALLOCATOR - -#ifndef NDEBUG -template -INLINE void *dallocator:: -allocate(size_t n) { - return default_operator_new(n); -} - -template -INLINE void dallocator:: -deallocate(void *p, size_t) { - default_operator_delete(p); -} -#endif // NDEBUG - -#else // GCC_STYLE_ALLOCATOR - -#ifndef NDEBUG -template -INLINE dallocator::pointer dallocator:: -allocate(dallocator::size_type n, allocator::const_pointer) { - return (dallocator::pointer)default_operator_new(n * sizeof(Type)); -} - -template -INLINE void dallocator:: -//deallocate(dallocator::pointer p, allocator::size_type) { -deallocate(void *p, allocator::size_type) { - default_operator_delete(p); -} -#endif // NDEBUG - -#endif // GCC_STYLE_ALLOCATOR +// Filename: dallocator.T +// Created by: drose (05Jun01) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#ifdef GCC_STYLE_ALLOCATOR + +#ifndef NDEBUG +template +INLINE void *dallocator:: +allocate(size_t n) { + return default_operator_new(n); +} + +template +INLINE void dallocator:: +deallocate(void *p, size_t) { + default_operator_delete(p); +} +#endif // NDEBUG + +#else // GCC_STYLE_ALLOCATOR + +#ifndef NDEBUG +template +INLINE dallocator::pointer dallocator:: +allocate(dallocator::size_type n, allocator::const_pointer) { + return (dallocator::pointer)default_operator_new(n * sizeof(Type)); +} + +template +INLINE void dallocator:: +//deallocate(dallocator::pointer p, allocator::size_type) { +deallocate(void *p, allocator::size_type) { + default_operator_delete(p); +} +#endif // NDEBUG + +#endif // GCC_STYLE_ALLOCATOR diff --git a/dtool/src/dtoolbase/dallocator.h b/dtool/src/dtoolbase/dallocator.h index 28b1c2135d..71fd014a02 100644 --- a/dtool/src/dtoolbase/dallocator.h +++ b/dtool/src/dtoolbase/dallocator.h @@ -1,68 +1,68 @@ -// Filename: dallocator.h -// Created by: drose (05Jun01) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef DALLOCATOR_H -#define DALLOCATOR_H - -#include "dtoolbase.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : dallocator -// Description : This is similar to pallocator, but always uses the -// default new and delete handlers defined in -// dtoolbase_cc.h; it never calls the hooks assigned by -// redefining global_operator_new, etc. -// -// This is needed in those rare cases when we need to -// allocate memory for STL without going through the -// callback hooks, for instance to implement STL tables -// within the MemoryUsage class itself. -//////////////////////////////////////////////////////////////////// - -#ifdef GCC_STYLE_ALLOCATOR -// Early versions of gcc used its own kind of allocator, somewhat -// different from the STL standard. - -template -class dallocator : public alloc { -public: -#ifndef NDEBUG - static void *allocate(size_t n); - static void deallocate(void *p, size_t n); -#endif // NDEBUG -}; - -#else // GCC_STYLE_ALLOCATOR - -template -class dallocator : public allocator { -public: -#ifndef NDEBUG - INLINE pointer allocate(size_type n, allocator::const_pointer hint = 0); - // INLINE void deallocate(pointer p, size_type n); - INLINE void deallocate(void *p, size_type n); -#endif // NDEBUG -}; -#endif // GCC_STYLE_ALLOCATOR - -#include "dallocator.T" - -#endif - +// Filename: dallocator.h +// Created by: drose (05Jun01) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#ifndef DALLOCATOR_H +#define DALLOCATOR_H + +#include "dtoolbase.h" + +#include + +//////////////////////////////////////////////////////////////////// +// Class : dallocator +// Description : This is similar to pallocator, but always uses the +// default new and delete handlers defined in +// dtoolbase_cc.h; it never calls the hooks assigned by +// redefining global_operator_new, etc. +// +// This is needed in those rare cases when we need to +// allocate memory for STL without going through the +// callback hooks, for instance to implement STL tables +// within the MemoryUsage class itself. +//////////////////////////////////////////////////////////////////// + +#ifdef GCC_STYLE_ALLOCATOR +// Early versions of gcc used its own kind of allocator, somewhat +// different from the STL standard. + +template +class dallocator : public alloc { +public: +#ifndef NDEBUG + static void *allocate(size_t n); + static void deallocate(void *p, size_t n); +#endif // NDEBUG +}; + +#else // GCC_STYLE_ALLOCATOR + +template +class dallocator : public allocator { +public: +#ifndef NDEBUG + INLINE pointer allocate(size_type n, allocator::const_pointer hint = 0); + // INLINE void deallocate(pointer p, size_type n); + INLINE void deallocate(void *p, size_type n); +#endif // NDEBUG +}; +#endif // GCC_STYLE_ALLOCATOR + +#include "dallocator.T" + +#endif +