]> git.saurik.com Git - apple/icu.git/blob - icuSources/io/ucln_io.c
ICU-8.11.2.tar.gz
[apple/icu.git] / icuSources / io / ucln_io.c
1 /*
2 ******************************************************************************
3 * *
4 * Copyright (C) 2001-2006, International Business Machines *
5 * Corporation and others. All Rights Reserved. *
6 * *
7 ******************************************************************************
8 * file name: ucln_io.c
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2006August11
14 * created by: George Rhoten
15 */
16
17 #include "ucln.h"
18 #include "ucln_io.h"
19 #include "umutex.h"
20 #include "uassert.h"
21
22 /* Leave this copyright notice here! It needs to go somewhere in this library. */
23 static const char copyright[] = U_COPYRIGHT_STRING;
24
25 static cleanupFunc *gCleanupFunctions[UCLN_IO_COUNT];
26
27 static UBool io_cleanup(void)
28 {
29 ECleanupIOType libType = UCLN_IO_START;
30
31 while (++libType<UCLN_IO_COUNT) {
32 if (gCleanupFunctions[libType])
33 {
34 gCleanupFunctions[libType]();
35 gCleanupFunctions[libType] = NULL;
36 }
37 }
38 return TRUE;
39 }
40
41 void ucln_io_registerCleanup(ECleanupIOType type,
42 cleanupFunc *func)
43 {
44 U_ASSERT(UCLN_IO_START < type && type < UCLN_IO_COUNT);
45 ucln_registerCleanup(UCLN_IO, io_cleanup);
46 if (UCLN_IO_START < type && type < UCLN_IO_COUNT)
47 {
48 gCleanupFunctions[type] = func;
49 }
50 }
51