ICU-770 incorporate the udata_cleanup into the internal API

X-SVN-Rev: 5488
This commit is contained in:
George Rhoten 2001-08-17 00:18:49 +00:00
parent 173a4678e2
commit 44283cc553
5 changed files with 26 additions and 31 deletions

View file

@ -77,7 +77,7 @@ uchar.o ucmp8.o ucmp16.o ucmp32.o ucmpe32.o uvector.o uhash.o uhash_us.o \
unames.o unicode.o unistr.o ustring.o cstring.o utf_impl.o \
scsu.o ucnv.o ucnv_bld.o ucnv_cb.o ucnv_cnv.o ucnv_err.o ucnv_io.o convert.o \
ucnvlat1.o ucnvmbcs.o ucnv_utf.o ucnv2022.o ucnvhz.o ucnv_lmb.o ucnvscsu.o \
ustream.o uscript.o ucnvisci.o
ustream.o uscript.o ucnvisci.o ucln_cmn.o
STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O))

View file

@ -24,4 +24,6 @@ void u_cleanup(void)
ucln_ustring();
ucln_ucnv();
ucln_ures();
}
udata_cleanup();
}

View file

@ -27,4 +27,6 @@ U_CAPI UBool U_EXPORT2 ucln_uloc(void);
U_CAPI UBool U_EXPORT2 ucln_ustring(void);
U_CAPI UBool U_EXPORT2 udata_cleanup(void);
#endif

View file

@ -22,6 +22,7 @@
#include "unicode/udata.h"
#include "unicode/uversion.h"
#include "uhash.h"
#include "ucln_cmn.h"
#ifdef OS390
#include <stdlib.h>
@ -545,7 +546,7 @@ pointerTOCLookupFn(const UDataMemory *pData,
/* common library functions ------------------------------------------------- */
static UDataMemory commonICUData={ NULL };
static UDataMemory commonICUData={ 0 };
static UBool
setCommonICUData(UDataMemory *pData) {
@ -810,15 +811,19 @@ static void checkCommonData(UDataMemory *udm, UErrorCode *err) {
}
U_CAPI void U_EXPORT2
U_CAPI UBool U_EXPORT2
udata_cleanup()
{
umtx_lock(NULL);
if (gHashTable) { /* Delete the cache of user data mappings. */
uhash_close(gHashTable); /* Table owns the contents, and will delete them. */
gHashTable = 0; /* Cleanup is not thread safe. */
}
udata_close(&commonICUData); /* Clean up common ICU Data */
umtx_unlock(NULL);
return TRUE; /* Everything was cleaned up */
}
@ -1021,7 +1026,7 @@ static UBool extendICUData()
}
umtx_unlock(NULL);
return U_SUCCESS(???);
return TRUE; /* SUCCESS? */
#endif /* OS390 */
}
@ -1085,19 +1090,19 @@ udata_setAppData(const char *path, const void *data, UErrorCode *err)
udm.pHeader = data;
checkCommonData(&udm, err);
udata_cacheDataItem(path, &udm, err);
};
}
/*------------------------------------------------------------------------------*
* *
* checkDataItem Given a freshly located/loaded data item, either *
* an entry in a common file or a separately loaded file, *
* sanity check its header, and see if the data is *
* acceptable to the app. *
* If the data is good, create and return a UDataMemory *
* object that can be returned to the application. *
* Return NULL on any sort of failure. *
* *
*------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*
* *
* checkDataItem Given a freshly located/loaded data item, either *
* an entry in a common file or a separately loaded file, *
* sanity check its header, and see if the data is *
* acceptable to the app. *
* If the data is good, create and return a UDataMemory *
* object that can be returned to the application. *
* Return NULL on any sort of failure. *
* *
*----------------------------------------------------------------------------*/
static UDataMemory *
checkDataItem
(

View file

@ -289,20 +289,6 @@ udata_setCommonData(const void *data, UErrorCode *err);
U_CAPI void U_EXPORT2
udata_setAppData(const char *path, const void *data, UErrorCode *err);
/**
* Clean-up function for allocated memory and any other resources owned
* by udata. Deletes all such items. Everything is returned to its initial
* state.
*
* This function is called by <fill in the name>. Applicataions normally
* have no reason to call it directly.
*
* @draft
*/
U_CAPI void U_EXPORT2
udata_cleanup();
U_CDECL_END
#endif