]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/ucln_cmn.c
ICU-6.2.8.tar.gz
[apple/icu.git] / icuSources / common / ucln_cmn.c
1 /*
2 ******************************************************************************
3 * *
4 * Copyright (C) 2001-2004, International Business Machines *
5 * Corporation and others. All Rights Reserved. *
6 * *
7 ******************************************************************************
8 * file name: ucln_cmn.c
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 "unicode/utypes.h"
18 #include "unicode/uclean.h"
19 #include "utracimp.h"
20 #include "ustr_imp.h"
21 #include "unormimp.h"
22 #include "ucln_cmn.h"
23 #include "umutex.h"
24 #include "ucln.h"
25 #include "cmemory.h"
26 #include "uassert.h"
27
28 static cleanupFunc *gCommonCleanupFunctions[UCLN_COMMON_COUNT];
29
30 void ucln_common_registerCleanup(ECleanupCommonType type,
31 cleanupFunc *func)
32 {
33 U_ASSERT(UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT);
34 if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT)
35 {
36 gCommonCleanupFunctions[type] = func;
37 }
38 }
39
40 U_CFUNC UBool ucln_common_lib_cleanup(void) {
41 ECleanupCommonType commonFunc;
42
43 for (commonFunc = UCLN_COMMON_START+1; commonFunc<UCLN_COMMON_COUNT; commonFunc++) {
44 if (gCommonCleanupFunctions[commonFunc])
45 {
46 gCommonCleanupFunctions[commonFunc]();
47 gCommonCleanupFunctions[commonFunc] = NULL;
48 }
49 }
50 return TRUE;
51 }
52