Commit:    c052b9c99ac09069d3f7c8ca5904c499ec842336
Author:    Gustavo Lopes <glo...@safelinq.com>         Mon, 23 Jul 2012 
16:38:27 +0200
Parents:   0dfcc3e798cd54714f792bf7507c37b96146ee1b
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=c052b9c99ac09069d3f7c8ca5904c499ec842336

Log:
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().

Changed paths:
  M  ext/intl/collator/collator_create.c
  M  ext/intl/dateformat/dateformat_create.cpp
  M  ext/intl/formatter/formatter_main.c
  M  ext/intl/locale/locale_methods.c
  M  ext/intl/msgformat/msgformat.c
  M  ext/intl/msgformat/msgformat_format.c
  M  ext/intl/msgformat/msgformat_parse.c
  M  ext/intl/php_intl.c


Diff:
diff --git a/ext/intl/collator/collator_create.c 
b/ext/intl/collator/collator_create.c
index 0f0cc19..a3b7015 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 fef93e9..7fefbe7 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 8fa1756..96f1bcf 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 936e314..d1a86d8 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 0a01204..45e5c71 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 3965232..4b81cfe 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 f540b1d..413d3b1 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 41a1d1c..38175ca 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;
 }
 /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to