gecko-dev/intl/icu/source/common/uobject.cpp

106 строки
3.2 KiB
C++
Исходник Обычный вид История

// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
* Copyright (C) 2002-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
* file name: uobject.h
* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
* created on: 2002jun26
* created by: Markus W. Scherer
*/
#include "unicode/uobject.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN
#if U_OVERRIDE_CXX_ALLOCATION
/*
* Default implementation of UMemory::new/delete
* using uprv_malloc() and uprv_free().
*
* For testing, this is used together with a list of imported symbols to verify
* that ICU is not using the global ::new and ::delete operators.
*
* These operators can be implemented like this or any other appropriate way
* when customizing ICU for certain environments.
* Whenever ICU is customized in binary incompatible ways please be sure
* to use library name suffixes to distinguish such libraries from
* the standard build.
*
* Instead of just modifying these C++ new/delete operators, it is usually best
* to modify the uprv_malloc()/uprv_free()/uprv_realloc() functions in cmemory.c.
*
* Memory test on Windows/MSVC 6:
* The global operators new and delete look as follows:
* 04F 00000000 UNDEF notype () External | ??2@YAPAXI@Z (void * __cdecl operator new(unsigned int))
* 03F 00000000 UNDEF notype () External | ??3@YAXPAX@Z (void __cdecl operator delete(void *))
*
* These lines are from output generated by the MSVC 6 tool dumpbin with
* dumpbin /symbols *.obj
*
* ??2@YAPAXI@Z and ??3@YAXPAX@Z are the linker symbols in the .obj
* files and are imported from msvcrtd.dll (in a debug build).
*
* Make sure that with the UMemory operators new and delete defined these two symbols
* do not appear in the dumpbin /symbols output for the ICU libraries!
*
* If such a symbol appears in the output then look in the preceding lines in the output
* for which file and function calls the global new or delete operator,
* and replace with uprv_malloc/uprv_free.
*/
void * U_EXPORT2 UMemory::operator new(size_t size) U_NO_THROW {
return uprv_malloc(size);
}
void U_EXPORT2 UMemory::operator delete(void *p) U_NO_THROW {
if(p!=NULL) {
uprv_free(p);
}
}
void * U_EXPORT2 UMemory::operator new[](size_t size) U_NO_THROW {
return uprv_malloc(size);
}
void U_EXPORT2 UMemory::operator delete[](void *p) U_NO_THROW {
if(p!=NULL) {
uprv_free(p);
}
}
#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() {}
Bug 924839 - Update our embedded ICU to 52.1, plus a very few local patches. r=lots of people, see subsequent lines in this commit message for the original subcomponents (merged together for landing), and the original bug for the original patch divisions Bug 924839 - Remove a patch already part of ICU 52.1. See http://bugs.icu-project.org/trac/ticket/10283 but also note the relevant code was removed completely upstream. r=glandium * * * Bug 924839 - Remove another patch already part of ICU 52.1. See http://bugs.icu-project.org/trac/ticket/10290 for that. r=gaston * * * Bug 924839 - Remove another patch already in ICU 52.1. See http://bugs.icu-project.org/trac/ticket/10045 for more. r=Norbert * * * Bug 924839 - Remove another patch already applied upstream. See http://bugs.icu-project.org/trac/changeset/32937 for more. r=gaston * * * Bug 924839 - Update the ICU update script to update to 52.1, *without* applying any of our local patches. r=glandium * * * Bug 924839 - Make the ICU update script only do updating within intl/icu/source and nowhere else. r=glandium * * * Bug 924839 - Implement the changes that would be made by |cd intl/; ./update-icu.sh http://source.icu-project.org/repos/icu/icu/tags/release-52-1/;|, run with the prior changesets' changes made (thus not applying any of our local patches). These changes don't actually work without subsequent adjustments, but this provides a codebase upon which those adjustments can be made, for the purpose of generating local patches to be kept in intl/icu-patches/. rs=the-usual-suspects * * * Bug 924839 - Update the bug 899722 local patch to make runConfigureICU not override CC/CXX on BSD systems. r=gaston * * * Bug 924839 - Update the bug 724533 patch that makes ICU builds with MozillaBuild on Windows. r=glandium * * * Bug 924839 - Import an upstream patch fixing the genrb tool to properly handle the -R (--omitCollationRules) option. See http://bugs.icu-project.org/trac/ticket/10043 for the original bug report and a link to the ultimate upstream landing. r=Norbert * * * Bug 924839 - Import the upstream fix for http://bugs.icu-project.org/trac/ticket/10486 so that ICU with -DU_USING_ICU_NAMESPACE=0 will compile on Windows. r=Norbert * * * Bug 924839 - Adjust the update script to update ICU, then to apply all local patches (rather than skipping the second step). Thus if the update script is properly run, now, the final result should be no changes at all to the tree. NOT REVIEWED YET * * * Bug 924839 - Update jstests that depend on CLDR locale data to match CLDR 24. r=Norbert
2013-11-13 04:23:48 +04:00
UClassID UObject::getDynamicClassID() const { return NULL; }
U_NAMESPACE_END
U_NAMESPACE_USE
U_CAPI void U_EXPORT2
uprv_deleteUObject(void *obj) {
delete static_cast<UObject *>(obj);
}