diff options
author | Gustavo Lopes <glopes@safelinq.com> | 2012-07-23 16:38:27 +0200 |
---|---|---|
committer | Gustavo Lopes <glopes@safelinq.com> | 2012-07-23 16:38:27 +0200 |
commit | c052b9c99ac09069d3f7c8ca5904c499ec842336 (patch) | |
tree | e584f68eab1bf1369b642e1008af4598647d143b /ext | |
parent | 0dfcc3e798cd54714f792bf7507c37b96146ee1b (diff) | |
download | php-git-c052b9c99ac09069d3f7c8ca5904c499ec842336.tar.gz |
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().
Diffstat (limited to 'ext')
-rwxr-xr-x | ext/intl/collator/collator_create.c | 2 | ||||
-rw-r--r-- | ext/intl/dateformat/dateformat_create.cpp | 4 | ||||
-rwxr-xr-x | ext/intl/formatter/formatter_main.c | 2 | ||||
-rwxr-xr-x | ext/intl/locale/locale_methods.c | 16 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat.c | 2 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_format.c | 2 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_parse.c | 2 | ||||
-rwxr-xr-x | ext/intl/php_intl.c | 9 |
8 files changed, 15 insertions, 24 deletions
diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index 0f0cc193e4..a3b70159f2 100755 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -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. */ diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index fef93e93d9..7fefbe7449 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -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); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 8fa17560b8..96f1bcf2e3 100755 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -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. */ diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 936e3142ad..d1a86d8ee2 100755 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -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); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 0a01204fae..45e5c7158b 100755 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -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 diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index 39652327b9..4b81cfe2b4 100755 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -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 diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index f540b1d0c4..413d3b1f15 100755 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -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 diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 41a1d1c0af..38175ca54c 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -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; } /* }}} */ |