intl/icu/source/io/ucln_io.c

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 ******************************************************************************
michael@0 3 * *
michael@0 4 * Copyright (C) 2001-2013, International Business Machines *
michael@0 5 * Corporation and others. All Rights Reserved. *
michael@0 6 * *
michael@0 7 ******************************************************************************
michael@0 8 * file name: ucln_io.c
michael@0 9 * encoding: US-ASCII
michael@0 10 * tab size: 8 (not used)
michael@0 11 * indentation:4
michael@0 12 *
michael@0 13 * created on: 2006August11
michael@0 14 * created by: George Rhoten
michael@0 15 */
michael@0 16
michael@0 17 #include "ucln.h"
michael@0 18 #include "ucln_io.h"
michael@0 19 #include "uassert.h"
michael@0 20
michael@0 21 #ifndef U_IO_IMPLEMENTATION
michael@0 22 #error U_IO_IMPLEMENTATION not set - must be set for all ICU source files in io/ - see http://userguide.icu-project.org/howtouseicu
michael@0 23 #endif
michael@0 24
michael@0 25
michael@0 26 /** Auto-client */
michael@0 27 #define UCLN_TYPE UCLN_IO
michael@0 28 #include "ucln_imp.h"
michael@0 29
michael@0 30 /* Leave this copyright notice here! It needs to go somewhere in this library. */
michael@0 31 static const char copyright[] = U_COPYRIGHT_STRING;
michael@0 32
michael@0 33 static cleanupFunc *gCleanupFunctions[UCLN_IO_COUNT];
michael@0 34
michael@0 35 static UBool io_cleanup(void)
michael@0 36 {
michael@0 37 ECleanupIOType libType = UCLN_IO_START;
michael@0 38
michael@0 39 while (++libType<UCLN_IO_COUNT) {
michael@0 40 if (gCleanupFunctions[libType])
michael@0 41 {
michael@0 42 gCleanupFunctions[libType]();
michael@0 43 gCleanupFunctions[libType] = NULL;
michael@0 44 }
michael@0 45 }
michael@0 46 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
michael@0 47 ucln_unRegisterAutomaticCleanup();
michael@0 48 #endif
michael@0 49 return TRUE;
michael@0 50 }
michael@0 51
michael@0 52 void ucln_io_registerCleanup(ECleanupIOType type,
michael@0 53 cleanupFunc *func)
michael@0 54 {
michael@0 55 U_ASSERT(UCLN_IO_START < type && type < UCLN_IO_COUNT);
michael@0 56 ucln_registerCleanup(UCLN_IO, io_cleanup);
michael@0 57 if (UCLN_IO_START < type && type < UCLN_IO_COUNT)
michael@0 58 {
michael@0 59 gCleanupFunctions[type] = func;
michael@0 60 }
michael@0 61
michael@0 62 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
michael@0 63 ucln_registerAutomaticCleanup();
michael@0 64 #endif
michael@0 65 }
michael@0 66

mercurial