Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | ****************************************************************************** |
michael@0 | 3 | * * |
michael@0 | 4 | * Copyright (C) 2001-2009, International Business Machines * |
michael@0 | 5 | * Corporation and others. All Rights Reserved. * |
michael@0 | 6 | * * |
michael@0 | 7 | ****************************************************************************** |
michael@0 | 8 | * file name: ucln_in.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: 2001July05 |
michael@0 | 14 | * created by: George Rhoten |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #include "ucln.h" |
michael@0 | 18 | #include "ucln_in.h" |
michael@0 | 19 | #include "uassert.h" |
michael@0 | 20 | |
michael@0 | 21 | /** Auto-client for UCLN_I18N **/ |
michael@0 | 22 | #define UCLN_TYPE UCLN_I18N |
michael@0 | 23 | #include "ucln_imp.h" |
michael@0 | 24 | |
michael@0 | 25 | /* Leave this copyright notice here! It needs to go somewhere in this library. */ |
michael@0 | 26 | static const char copyright[] = U_COPYRIGHT_STRING; |
michael@0 | 27 | |
michael@0 | 28 | static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT]; |
michael@0 | 29 | |
michael@0 | 30 | static UBool i18n_cleanup(void) |
michael@0 | 31 | { |
michael@0 | 32 | ECleanupI18NType libType = UCLN_I18N_START; |
michael@0 | 33 | |
michael@0 | 34 | while (++libType<UCLN_I18N_COUNT) { |
michael@0 | 35 | if (gCleanupFunctions[libType]) |
michael@0 | 36 | { |
michael@0 | 37 | gCleanupFunctions[libType](); |
michael@0 | 38 | gCleanupFunctions[libType] = NULL; |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL)) |
michael@0 | 42 | ucln_unRegisterAutomaticCleanup(); |
michael@0 | 43 | #endif |
michael@0 | 44 | return TRUE; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | void ucln_i18n_registerCleanup(ECleanupI18NType type, |
michael@0 | 48 | cleanupFunc *func) |
michael@0 | 49 | { |
michael@0 | 50 | U_ASSERT(UCLN_I18N_START < type && type < UCLN_I18N_COUNT); |
michael@0 | 51 | ucln_registerCleanup(UCLN_I18N, i18n_cleanup); |
michael@0 | 52 | if (UCLN_I18N_START < type && type < UCLN_I18N_COUNT) |
michael@0 | 53 | { |
michael@0 | 54 | gCleanupFunctions[type] = func; |
michael@0 | 55 | } |
michael@0 | 56 | #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL)) |
michael@0 | 57 | ucln_registerAutomaticCleanup(); |
michael@0 | 58 | #endif |
michael@0 | 59 | } |
michael@0 | 60 |