X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..4f1e1a09ce4daed860e35d359ce2fceccb0764e8:/icuSources/common/uobject.cpp diff --git a/icuSources/common/uobject.cpp b/icuSources/common/uobject.cpp index e425c881..1133dd9b 100644 --- a/icuSources/common/uobject.cpp +++ b/icuSources/common/uobject.cpp @@ -1,12 +1,14 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * -* Copyright (C) 2002, International Business Machines +* Copyright (C) 2002-2012, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: uobject.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -15,13 +17,12 @@ */ #include "unicode/uobject.h" - -#if U_OVERRIDE_CXX_ALLOCATION - #include "cmemory.h" U_NAMESPACE_BEGIN +#if U_OVERRIDE_CXX_ALLOCATION + /* * Default implementation of UMemory::new/delete * using uprv_malloc() and uprv_free(). @@ -57,27 +58,48 @@ U_NAMESPACE_BEGIN * and replace with uprv_malloc/uprv_free. */ -void *UMemory::operator new(size_t size) { +void * U_EXPORT2 UMemory::operator new(size_t size) U_NO_THROW { return uprv_malloc(size); } -void UMemory::operator delete(void *p) { +void U_EXPORT2 UMemory::operator delete(void *p) U_NO_THROW { if(p!=NULL) { uprv_free(p); } } -void *UMemory::operator new[](size_t size) { +void * U_EXPORT2 UMemory::operator new[](size_t size) U_NO_THROW { return uprv_malloc(size); } -void UMemory::operator delete[](void *p) { +void U_EXPORT2 UMemory::operator delete[](void *p) U_NO_THROW { if(p!=NULL) { uprv_free(p); } } -U_NAMESPACE_END +#if U_HAVE_DEBUG_LOCATION_NEW +void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NO_THROW { + return UMemory::operator new(size); +} + +void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NO_THROW { + UMemory::operator delete(p); +} +#endif /* U_HAVE_DEBUG_LOCATION_NEW */ + #endif +UObject::~UObject() {} + +UClassID UObject::getDynamicClassID() const { return NULL; } + +U_NAMESPACE_END + +U_NAMESPACE_USE + +U_CAPI void U_EXPORT2 +uprv_deleteUObject(void *obj) { + delete static_cast(obj); +}