ICU-4497 u_init() is not necessary any more for thread safety, and loads the converter alias table instead of the Unicode properties files (whose data is now hardcoded)
X-SVN-Rev: 17541
This commit is contained in:
parent
a07a650035
commit
056630b8fd
@ -20,6 +20,7 @@
|
||||
#include "ustr_imp.h"
|
||||
#include "unormimp.h"
|
||||
#include "ucln_cmn.h"
|
||||
#include "ucnv_io.h"
|
||||
#include "umutex.h"
|
||||
#include "ucln.h"
|
||||
#include "cmemory.h"
|
||||
@ -93,6 +94,23 @@ u_init(UErrorCode *status) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* 2005-may-02
|
||||
*
|
||||
* ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character
|
||||
* properties for APIs that want to be fast.
|
||||
* Therefore, we need not load them here nor check for errors.
|
||||
* Instead, we load the converter alias table to see if any ICU data
|
||||
* is available.
|
||||
* Users should really open the service objects they need and check
|
||||
* for errors there, to make sure that the actual items they need are
|
||||
* available.
|
||||
*/
|
||||
#if !UCONFIG_NO_CONVERSION
|
||||
ucnv_io_countStandards(status);
|
||||
#endif
|
||||
#else
|
||||
/* Do any required init for services that don't have open operations
|
||||
* and use "only" the double-check initialization method for performance
|
||||
* reasons (avoiding a mutex lock even for _checking_ whether the
|
||||
@ -109,6 +127,7 @@ u_init(UErrorCode *status) {
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
/* Normalization */
|
||||
unorm_haveData(status);
|
||||
#endif
|
||||
#endif
|
||||
gICUInitialized = TRUE; /* TODO: don't set if U_FAILURE? */
|
||||
umtx_unlock(&gICUInitMutex);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2001-2004, International Business Machines *
|
||||
* Copyright (C) 2001-2005, International Business Machines *
|
||||
* Corporation and others. All Rights Reserved. *
|
||||
* *
|
||||
******************************************************************************
|
||||
@ -20,7 +20,20 @@
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
/**
|
||||
* Initialize ICU. This function loads and initializes data items
|
||||
* Initialize ICU. The description further below applies to ICU 2.6 to ICU 3.4.
|
||||
* Starting with ICU 3.4, u_init() needs not be called any more for
|
||||
* ensuring thread safety, but it can give an indication for whether ICU
|
||||
* can load its data. In ICU 3.4, it will try to load the converter alias table
|
||||
* (cnvalias.icu) and give an error code if that fails.
|
||||
* This may change in the future.
|
||||
* <p>
|
||||
* For ensuring the availability of necessary data, an application should
|
||||
* open the service objects (converters, collators, etc.) that it will use
|
||||
* and check for error codes there.
|
||||
* <p>
|
||||
* Documentation for ICU 2.6 to ICU 3.4:
|
||||
* <p>
|
||||
* This function loads and initializes data items
|
||||
* that are required internally by various ICU functions. Use of this explicit
|
||||
* initialization is required in multi-threaded applications; in
|
||||
* single threaded apps, use is optional, but incurs little additional
|
||||
|
Loading…
Reference in New Issue
Block a user