mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Do not fetch default locale once on minit or rinit
The default locale is now requested to ICU when it's needed by using intl_get_default_locale().
This commit is contained in:
parent
0dfcc3e798
commit
c052b9c99a
8 changed files with 15 additions and 24 deletions
|
@ -48,7 +48,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
|||
co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC );
|
||||
|
||||
if(locale_len == 0) {
|
||||
locale = INTL_G(default_locale);
|
||||
locale = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
/* Open ICU collator. */
|
||||
|
|
|
@ -40,7 +40,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
|||
{
|
||||
zval *object;
|
||||
|
||||
char *locale_str;
|
||||
const char *locale_str;
|
||||
int locale_len = 0;
|
||||
Locale locale;
|
||||
long date_type = 0;
|
||||
|
@ -72,7 +72,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
|||
|
||||
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
|
||||
if (locale_len == 0) {
|
||||
locale_str = INTL_G(default_locale);
|
||||
locale_str = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
locale = Locale::createFromName(locale_str);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
|||
}
|
||||
|
||||
if(locale_len == 0) {
|
||||
locale = INTL_G(default_locale);
|
||||
locale = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
/* Create an ICU number formatter. */
|
||||
|
|
|
@ -390,7 +390,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
|||
}
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = INTL_G(default_locale);
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
/* Call ICU get */
|
||||
|
@ -496,7 +496,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
|||
}
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = INTL_G(default_locale);
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
if( strcmp(tag_name, DISP_NAME) != 0 ){
|
||||
|
@ -518,7 +518,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
|||
|
||||
/* Check if disp_loc_name passed , if not use default locale */
|
||||
if( !disp_loc_name){
|
||||
disp_loc_name = estrdup(INTL_G(default_locale));
|
||||
disp_loc_name = estrdup(intl_locale_get_default(TSRMLS_C));
|
||||
free_loc_name = 1;
|
||||
}
|
||||
|
||||
|
@ -690,7 +690,7 @@ PHP_FUNCTION( locale_get_keywords )
|
|||
}
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = INTL_G(default_locale);
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
/* Get the keywords */
|
||||
|
@ -1097,7 +1097,7 @@ PHP_FUNCTION(locale_parse)
|
|||
}
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = INTL_G(default_locale);
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
array_init( return_value );
|
||||
|
@ -1145,7 +1145,7 @@ PHP_FUNCTION(locale_get_all_variants)
|
|||
}
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = INTL_G(default_locale);
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ PHP_FUNCTION(locale_filter_matches)
|
|||
}
|
||||
|
||||
if(loc_range_len == 0) {
|
||||
loc_range = INTL_G(default_locale);
|
||||
loc_range = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
if( strcmp(loc_range,"*")==0){
|
||||
|
@ -1537,7 +1537,7 @@ PHP_FUNCTION(locale_lookup)
|
|||
}
|
||||
|
||||
if(loc_range_len == 0) {
|
||||
loc_range = INTL_G(default_locale);
|
||||
loc_range = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
hash_arr = HASH_OF(arr);
|
||||
|
|
|
@ -61,7 +61,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
|||
}
|
||||
|
||||
if(locale_len == 0) {
|
||||
locale = INTL_G(default_locale);
|
||||
locale = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
#ifdef MSG_FORMAT_QUOTE_APOS
|
||||
|
|
|
@ -134,7 +134,7 @@ PHP_FUNCTION( msgfmt_format_message )
|
|||
}
|
||||
|
||||
if(slocale_len == 0) {
|
||||
slocale = INTL_G(default_locale);
|
||||
slocale = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
#ifdef MSG_FORMAT_QUOTE_APOS
|
||||
|
|
|
@ -126,7 +126,7 @@ PHP_FUNCTION( msgfmt_parse_message )
|
|||
}
|
||||
|
||||
if(slocale_len == 0) {
|
||||
slocale = INTL_G(default_locale);
|
||||
slocale = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
#ifdef MSG_FORMAT_QUOTE_APOS
|
||||
|
|
|
@ -1011,11 +1011,6 @@ PHP_MINIT_FUNCTION( intl )
|
|||
/* Global error handling. */
|
||||
intl_error_init( NULL TSRMLS_CC );
|
||||
|
||||
/* Set the default_locale value */
|
||||
if( INTL_G(default_locale) == NULL ) {
|
||||
INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -1039,10 +1034,6 @@ PHP_MSHUTDOWN_FUNCTION( intl )
|
|||
*/
|
||||
PHP_RINIT_FUNCTION( intl )
|
||||
{
|
||||
/* Set the default_locale value */
|
||||
if( INTL_G(default_locale) == NULL ) {
|
||||
INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue