From 01aff246f17c8acdec93e12d2e3cf48748740b63 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Fri, 31 Mar 2006 07:11:33 +0000 Subject: [PATCH] ICU-5138 Separate cleaning registration from the uinit() implementation. X-SVN-Rev: 19502 --- icu4c/source/common/ucln_cmn.c | 28 +++++++++++++++++++++++++--- icu4c/source/common/ucln_cmn.h | 2 +- icu4c/source/common/uinit.c | 25 +------------------------ 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/icu4c/source/common/ucln_cmn.c b/icu4c/source/common/ucln_cmn.c index fe68ebdd238..452e628bb38 100644 --- a/icu4c/source/common/ucln_cmn.c +++ b/icu4c/source/common/ucln_cmn.c @@ -26,9 +26,11 @@ #include "uassert.h" static cleanupFunc *gCommonCleanupFunctions[UCLN_COMMON_COUNT]; +static cleanupFunc *gLibCleanupFunctions[UCLN_COMMON]; -void ucln_common_registerCleanup(ECleanupCommonType type, - cleanupFunc *func) +U_CFUNC void +ucln_common_registerCleanup(ECleanupCommonType type, + cleanupFunc *func) { U_ASSERT(UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT); if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT) @@ -37,9 +39,29 @@ void ucln_common_registerCleanup(ECleanupCommonType type, } } -U_CFUNC UBool ucln_common_lib_cleanup(void) { +U_CAPI void U_EXPORT2 +ucln_registerCleanup(ECleanupLibraryType type, + cleanupFunc *func) +{ + U_ASSERT(UCLN_START < type && type < UCLN_COMMON); + if (UCLN_START < type && type < UCLN_COMMON) + { + gLibCleanupFunctions[type] = func; + } +} + +U_CFUNC UBool ucln_lib_cleanup(void) { + ECleanupLibraryType libType = UCLN_START; ECleanupCommonType commonFunc = UCLN_COMMON_START; + for (libType++; libType