]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/ucln_in.c
ICU-531.31.tar.gz
[apple/icu.git] / icuSources / i18n / ucln_in.c
CommitLineData
b75a7d8f
A
1/*
2******************************************************************************
3* *
57a6839d 4* Copyright (C) 2001-2014, International Business Machines *
b75a7d8f
A
5* Corporation and others. All Rights Reserved. *
6* *
7******************************************************************************
374ca955 8* file name: ucln_in.c
b75a7d8f
A
9* encoding: US-ASCII
10* tab size: 8 (not used)
11* indentation:4
12*
13* created on: 2001July05
14* created by: George Rhoten
15*/
16
17#include "ucln.h"
18#include "ucln_in.h"
374ca955 19#include "uassert.h"
b75a7d8f 20
729e4ab9
A
21/** Auto-client for UCLN_I18N **/
22#define UCLN_TYPE UCLN_I18N
23#include "ucln_imp.h"
24
b75a7d8f
A
25/* Leave this copyright notice here! It needs to go somewhere in this library. */
26static const char copyright[] = U_COPYRIGHT_STRING;
27
374ca955
A
28static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
29
b75a7d8f
A
30static UBool i18n_cleanup(void)
31{
73c04bcf 32 ECleanupI18NType libType = UCLN_I18N_START;
57a6839d 33 (void)copyright; /* Suppress unused variable warning with clang. */
374ca955 34
73c04bcf 35 while (++libType<UCLN_I18N_COUNT) {
374ca955
A
36 if (gCleanupFunctions[libType])
37 {
38 gCleanupFunctions[libType]();
39 gCleanupFunctions[libType] = NULL;
40 }
41 }
729e4ab9
A
42#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
43 ucln_unRegisterAutomaticCleanup();
44#endif
b75a7d8f
A
45 return TRUE;
46}
47
374ca955
A
48void ucln_i18n_registerCleanup(ECleanupI18NType type,
49 cleanupFunc *func)
b75a7d8f 50{
374ca955 51 U_ASSERT(UCLN_I18N_START < type && type < UCLN_I18N_COUNT);
b75a7d8f 52 ucln_registerCleanup(UCLN_I18N, i18n_cleanup);
374ca955
A
53 if (UCLN_I18N_START < type && type < UCLN_I18N_COUNT)
54 {
55 gCleanupFunctions[type] = func;
56 }
729e4ab9
A
57#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
58 ucln_registerAutomaticCleanup();
59#endif
b75a7d8f
A
60}
61