2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2001-08-30 03:01:06 +00:00
|
|
|
/*
|
|
|
|
******************************************************************************
|
|
|
|
* *
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (C) 2001-2014, International Business Machines *
|
|
|
|
* Corporation and others. All Rights Reserved. *
|
2001-08-30 03:01:06 +00:00
|
|
|
* *
|
|
|
|
******************************************************************************
|
2014-04-23 23:22:13 +00:00
|
|
|
* file name: ucln_in.cpp
|
2017-02-03 18:57:23 +00:00
|
|
|
* encoding: UTF-8
|
2001-08-30 03:01:06 +00:00
|
|
|
* tab size: 8 (not used)
|
|
|
|
* indentation:4
|
|
|
|
*
|
|
|
|
* created on: 2001July05
|
|
|
|
* created by: George Rhoten
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ucln.h"
|
|
|
|
#include "ucln_in.h"
|
2014-04-25 17:27:53 +00:00
|
|
|
#include "mutex.h"
|
2004-09-12 23:19:33 +00:00
|
|
|
#include "uassert.h"
|
2001-08-30 03:01:06 +00:00
|
|
|
|
2009-09-03 20:40:02 +00:00
|
|
|
/** Auto-client for UCLN_I18N **/
|
|
|
|
#define UCLN_TYPE UCLN_I18N
|
|
|
|
#include "ucln_imp.h"
|
|
|
|
|
2003-06-02 18:40:09 +00:00
|
|
|
/* Leave this copyright notice here! It needs to go somewhere in this library. */
|
|
|
|
static const char copyright[] = U_COPYRIGHT_STRING;
|
|
|
|
|
2004-09-12 23:07:29 +00:00
|
|
|
static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
|
|
|
|
|
2016-09-27 23:39:01 +00:00
|
|
|
static UBool U_CALLCONV i18n_cleanup(void)
|
2001-08-30 03:01:06 +00:00
|
|
|
{
|
2014-04-23 23:22:13 +00:00
|
|
|
int32_t libType = UCLN_I18N_START;
|
2014-01-10 02:24:54 +00:00
|
|
|
(void)copyright; /* Suppress unused variable warning with clang. */
|
2004-09-12 23:07:29 +00:00
|
|
|
|
2006-08-24 18:51:49 +00:00
|
|
|
while (++libType<UCLN_I18N_COUNT) {
|
2004-09-12 23:07:29 +00:00
|
|
|
if (gCleanupFunctions[libType])
|
|
|
|
{
|
|
|
|
gCleanupFunctions[libType]();
|
|
|
|
gCleanupFunctions[libType] = NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-09-03 20:40:02 +00:00
|
|
|
#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
|
|
|
|
ucln_unRegisterAutomaticCleanup();
|
|
|
|
#endif
|
2001-08-31 02:14:47 +00:00
|
|
|
return TRUE;
|
2001-08-30 03:01:06 +00:00
|
|
|
}
|
|
|
|
|
2004-09-12 23:07:29 +00:00
|
|
|
void ucln_i18n_registerCleanup(ECleanupI18NType type,
|
2014-04-25 17:27:53 +00:00
|
|
|
cleanupFunc *func) {
|
2004-09-12 23:07:29 +00:00
|
|
|
U_ASSERT(UCLN_I18N_START < type && type < UCLN_I18N_COUNT);
|
|
|
|
{
|
2014-04-25 17:27:53 +00:00
|
|
|
icu::Mutex m; // See ticket 10295 for discussion.
|
|
|
|
ucln_registerCleanup(UCLN_I18N, i18n_cleanup);
|
|
|
|
if (UCLN_I18N_START < type && type < UCLN_I18N_COUNT) {
|
|
|
|
gCleanupFunctions[type] = func;
|
|
|
|
}
|
2004-09-12 23:07:29 +00:00
|
|
|
}
|
2009-09-03 20:40:02 +00:00
|
|
|
#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
|
|
|
|
ucln_registerAutomaticCleanup();
|
|
|
|
#endif
|
2001-08-30 03:01:06 +00:00
|
|
|
}
|
|
|
|
|