cgal/Old_Packages/Stl_port/stlport/new

100 lines
2.6 KiB
Plaintext

/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef __STLPORT_NEW
# define __STLPORT_NEW
# ifndef __STL_CONFIG_H
# include <stl_config.h>
# endif
#ifndef __STL_WINCE
#if defined (__BORLANDC__) && (__BORLANDC__ > 0x520)
// new.h uses ::malloc ;(
# include <cstdlib>
using __stl_native_std::malloc;
#endif
# if defined ( __STL_REDEFINE_STD ) && defined (std)
# undef std
# define __STL_RESUME_STD_FOR_NEW
# define __STLPORT_NATIVE_PASS
# endif
# if !defined (__STL_NO_NEW_NEW_HEADER)
# if defined (__GNUC__) && (__GNUC_MINOR__ >= 8 )
# include <../include/new>
# else
# include __STL_NATIVE_HEADER(new)
# endif
# else
# include __STL_NATIVE_HEADER(new.h)
# endif
# if defined ( __STL_RESUME_STD_FOR_NEW )
# undef __STL_RESUME_STD_FOR_NEW
# define std __STLPORT_NAMESPACE
# undef __STLPORT_NATIVE_PASS
# endif
# ifndef __STL_NO_BAD_ALLOC
# ifdef __STL_USE_OWN_NAMESPACE
__STL_BEGIN_NAMESPACE
using __STL_VENDOR_EXCEPT_STD::bad_alloc;
__STL_END_NAMESPACE
# endif /* __STL_OWN_NAMESPACE */
# else /* __STL_NO_BAD_ALLOC */
# include <exception>
__STL_BEGIN_NAMESPACE
class bad_alloc : public __STL_EXCEPTION_BASE {
public:
bad_alloc () __STL_NOTHROW { }
bad_alloc(const bad_alloc&) __STL_NOTHROW { }
bad_alloc& operator=(const bad_alloc&) __STL_NOTHROW {return *this;}
~bad_alloc () __STL_NOTHROW { }
const char* what() const __STL_NOTHROW { return "bad alloc"; }
};
__STL_END_NAMESPACE
#endif /* __STL_NO_BAD_ALLOC */
__STL_BEGIN_NAMESPACE
inline void* __stl_new(size_t __n) {
#if (( defined(__IBMCPP__)|| defined(__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined(__DEBUG_ALLOC__) )
return ::operator __STL_NEW(__n, __FILE__, __LINE__);
#else
return ::operator __STL_NEW(__n);
#endif
}
inline void __stl_delete(void* __p) {
#if (( defined(__IBMCPP__) || defined(__OS400__)|| defined (__xlC__) || defined (qTidyHeap)) && defined(__DEBUG_ALLOC__) )
::operator delete(__p, __FILE__, __LINE__);
#else
::operator delete(__p);
#endif
}
__STL_END_NAMESPACE
#endif /* WINCE */
#endif /* __STLPORT_NEW */
// Local Variables:
// mode:C++
// End: