]> granicus.if.org Git - php/commitdiff
Unicode support: zstr union
authorDmitry Stogov <dmitry@php.net>
Wed, 1 Mar 2006 16:27:47 +0000 (16:27 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 1 Mar 2006 16:27:47 +0000 (16:27 +0000)
sapi/apache/mod_php5.c
sapi/apache2filter/apache_config.c
sapi/apache2handler/apache_config.c
sapi/apache_hooks/mod_php5.c
sapi/apache_hooks/php_apache.c
sapi/cli/php_cli_readline.c

index 859886931827bbaa44f6606c9a155fc85fb654da..74042ad7775bc026042d5cc01d682dbbf132bd87 100644 (file)
@@ -718,7 +718,7 @@ static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_di
 {
        php_per_dir_entry *orig_per_dir_entry;
 
-       if (zend_u_hash_find(target_ht, hash_key->type, hash_key->u.string, hash_key->nKeyLength, (void **) &orig_per_dir_entry)==FAILURE) {
+       if (zend_u_hash_find(target_ht, hash_key->type, hash_key->arKey, hash_key->nKeyLength, (void **) &orig_per_dir_entry)==FAILURE) {
                return 1; /* does not exist in dest, copy from source */
        }
 
index a77a6b57143d3d5d307957b0ef6c472ff34369e8..8d6f7669950ba548df38df3a6997248ffa83ecdb 100644 (file)
@@ -131,7 +131,7 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
        php_conf_rec *d = base_conf, *e = new_conf;
        php_dir_entry *pe;
        php_dir_entry *data;
-       char *str;
+       zstr str;
        uint str_len;
        ulong num_index;
 
@@ -142,10 +142,10 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
                        zend_hash_move_forward(&d->config)) {
                pe = NULL;
                zend_hash_get_current_data(&d->config, (void **) &data);
-               if (zend_hash_find(&e->config, str, str_len, (void **) &pe) == SUCCESS) {
+               if (zend_hash_find(&e->config, str.s, str_len, (void **) &pe) == SUCCESS) {
                        if (pe->status >= data->status) continue;
                }
-               zend_hash_update(&e->config, str, str_len, data, sizeof(*data), NULL);
+               zend_hash_update(&e->config, str.s, str_len, data, sizeof(*data), NULL);
                phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, 
                                        data->status, pe?pe->status:-1));
        }
@@ -167,7 +167,7 @@ char *get_php_config(void *conf, char *name, size_t name_len)
 void apply_config(void *dummy)
 {
        php_conf_rec *d = dummy;
-       char *str;
+       zstr str;
        uint str_len;
        php_dir_entry *data;
        
@@ -176,8 +176,8 @@ void apply_config(void *dummy)
                                NULL) == HASH_KEY_IS_STRING;
                        zend_hash_move_forward(&d->config)) {
                zend_hash_get_current_data(&d->config, (void **) &data);
-               phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
-               if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, 
+               phpapdebug((stderr, "APPLYING (%s)(%s)\n", str.s, data->value));
+               if (zend_alter_ini_entry(str.s, str_len, data->value, data->value_len, 
                                        data->status, PHP_INI_STAGE_ACTIVATE) == FAILURE) {
                        phpapdebug((stderr, "..FAILED\n"));
                }       
index 729a4781254d20a887ad9c466301e86c31f4b3bc..49173b86ffdb9e724cfcfeeee5e402bf06627c8c 100644 (file)
@@ -121,7 +121,7 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
        php_conf_rec *d = base_conf, *e = new_conf;
        php_dir_entry *pe;
        php_dir_entry *data;
-       char *str;
+       zstr str;
        uint str_len;
        ulong num_index;
 
@@ -132,10 +132,10 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
                        zend_hash_move_forward(&d->config)) {
                pe = NULL;
                zend_hash_get_current_data(&d->config, (void **) &data);
-               if (zend_hash_find(&e->config, str, str_len, (void **) &pe) == SUCCESS) {
+               if (zend_hash_find(&e->config, str.s, str_len, (void **) &pe) == SUCCESS) {
                        if (pe->status >= data->status) continue;
                }
-               zend_hash_update(&e->config, str, str_len, data, sizeof(*data), NULL);
+               zend_hash_update(&e->config, str.s, str_len, data, sizeof(*data), NULL);
                phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
        }
        return new_conf;
@@ -156,7 +156,7 @@ char *get_php_config(void *conf, char *name, size_t name_len)
 void apply_config(void *dummy)
 {
        php_conf_rec *d = dummy;
-       char *str;
+       zstr str;
        uint str_len;
        php_dir_entry *data;
        
@@ -165,8 +165,8 @@ void apply_config(void *dummy)
                                NULL) == HASH_KEY_IS_STRING;
                        zend_hash_move_forward(&d->config)) {
                zend_hash_get_current_data(&d->config, (void **) &data);
-               phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
-               if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, PHP_INI_STAGE_ACTIVATE) == FAILURE) {
+               phpapdebug((stderr, "APPLYING (%s)(%s)\n", str.s, data->value));
+               if (zend_alter_ini_entry(str.s, str_len, data->value, data->value_len, data->status, PHP_INI_STAGE_ACTIVATE) == FAILURE) {
                        phpapdebug((stderr, "..FAILED\n"));
                }       
        }
index e829986629c8f56ccd305b18a1b51dd5c9889a50..6fb54fcac6f4e446d79ac25778e4db14a60d8bc3 100644 (file)
@@ -781,7 +781,7 @@ static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_di
 {
        php_per_dir_entry *new_per_dir_entry;
 
-       if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) {
+       if (zend_u_hash_find(target_ht, hash_key->type, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) {
                return 1; /* does not exist in dest, copy from source */
        }
 
index dff34bdad74117e02a6c53d10d041fb87ed24bb7..aaeaa76d6ca839c72f83ccd8792eff1cc5492086 100644 (file)
@@ -566,7 +566,7 @@ static void add_header_to_table(table *t, INTERNAL_FUNCTION_PARAMETERS)
        zval *first = NULL;
        zval *second = NULL;
        zval **entry, **value;
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        
@@ -584,7 +584,7 @@ static void add_header_to_table(table *t, INTERNAL_FUNCTION_PARAMETERS)
                                while (zend_hash_get_current_data_ex(Z_ARRVAL_P(first), (void **)&entry, &pos) == SUCCESS) {
                                        switch(zend_hash_get_current_key_ex(Z_ARRVAL_P(first), &string_key, &string_key_len, &num_key, 0, &pos)) {
                                                case HASH_KEY_IS_STRING:
-                                                       if (zend_hash_find(Z_ARRVAL_P(first), string_key, string_key_len, (void **)&value) == FAILURE) {
+                                                       if (zend_hash_find(Z_ARRVAL_P(first), string_key.s, string_key_len, (void **)&value) == FAILURE) {
                                                                zend_hash_move_forward_ex(Z_ARRVAL_P(first), &pos);
                                                                continue;
                                                        }
@@ -595,9 +595,9 @@ static void add_header_to_table(table *t, INTERNAL_FUNCTION_PARAMETERS)
 
                                                        convert_to_string_ex(value);
                                                        if (replace)
-                                                               ap_table_set(t, string_key, Z_STRVAL_PP(value));
+                                                               ap_table_set(t, string_key.s, Z_STRVAL_PP(value));
                                                        else
-                                                               ap_table_merge(t, string_key, Z_STRVAL_PP(value));
+                                                               ap_table_merge(t, string_key.s, Z_STRVAL_PP(value));
                                                        
                                                        break;
                                                case HASH_KEY_IS_LONG:
index 6cd3effcf2e4395a10e5f37e9a4cce72b7d3dcc5..23729d58e681e275aef386665338e2e001ebd857 100644 (file)
@@ -277,7 +277,7 @@ int cli_is_valid_code(char *code, int len, char **prompt TSRMLS_DC)
 
 static char *cli_completion_generator_ht(const char *text, int textlen, int *state, HashTable *ht, void **pData TSRMLS_DC) /* {{{ */
 {
-       char *name;
+       zstr name;
        ulong number;
 
        if (!(*state % 2)) {
@@ -286,12 +286,12 @@ static char *cli_completion_generator_ht(const char *text, int textlen, int *sta
        }
        while(zend_hash_has_more_elements(ht) == SUCCESS) {
                zend_hash_get_current_key(ht, &name, &number, 0);
-               if (!textlen || (UG(unicode) ? !zend_cmp_unicode_and_string((UChar *)name, (char *)text, textlen) : !strncmp(name, text, textlen))) {
+               if (!textlen || (UG(unicode) ? !zend_cmp_unicode_and_string(name.u, (char *)text, textlen) : !strncmp(name.s, text, textlen))) {
                        if (pData) {
                                zend_hash_get_current_data(ht, pData);
                        }
                        zend_hash_move_forward(ht);
-                       return name;
+                       return name.s;
                }
                if (zend_hash_move_forward(ht) == FAILURE) {
                        break;