diff options
| author | Dmitry Stogov <dmitry@php.net> | 2006-02-21 20:12:43 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2006-02-21 20:12:43 +0000 |
| commit | 0f1209ab3d1f9ec0f1ea7295fa987ba4dea270c8 (patch) | |
| tree | f599e4188e236ccf04fa0f74518e6c10bbcb5d14 /main/php_variables.c | |
| parent | fca6eecbe944effb6374e63271a008947b266e64 (diff) | |
| download | php-git-0f1209ab3d1f9ec0f1ea7295fa987ba4dea270c8.tar.gz | |
Portable unicode string API:
- use the same type (int) for zval.value.usr.len and zval.value.str.len
- use union "zstr" as char*/UChar* mixture instead of void*
- Z_UNISTR() and Z_UNILEN() no longer check for Z_TYPE()
- nuke int32_t from ZE (not finisned)
Diffstat (limited to 'main/php_variables.c')
| -rw-r--r-- | main/php_variables.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index 76f20edb8b..0555c23e9f 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -336,11 +336,11 @@ PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_a } else { escaped_index = index; } - if (zend_u_symtable_find(symtable1, IS_UNICODE, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE + if (zend_u_symtable_find(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { MAKE_STD_ZVAL(gpc_element); array_init(gpc_element); - zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } if (index!=escaped_index) { efree(escaped_index); @@ -369,7 +369,7 @@ plain_var: /* UTODO fix for php_addslashes case */ //char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); UChar *escaped_index = index; - zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); //efree(escaped_index); } break; @@ -804,7 +804,7 @@ static inline void php_register_server_variables(TSRMLS_D) static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { zval **src_entry, **dest_entry; - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; HashPosition pos; @@ -814,16 +814,17 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) zend_hash_internal_pointer_reset_ex(src, &pos); while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) { key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos); + /* FIXME: Unicode support??? */ if (Z_TYPE_PP(src_entry) != IS_ARRAY - || (key_type == HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS) + || (key_type == HASH_KEY_IS_STRING && zend_u_hash_find(dest, key_type, string_key, string_key_len, (void **) &dest_entry) != SUCCESS) || (key_type == HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) || Z_TYPE_PP(dest_entry) != IS_ARRAY ) { (*src_entry)->refcount++; if (key_type == HASH_KEY_IS_STRING) { /* if register_globals is on and working with main symbol table, prevent overwriting of GLOBALS */ - if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key, "GLOBALS", sizeof("GLOBALS") - 1)) { - zend_hash_update(dest, string_key, string_key_len, src_entry, sizeof(zval *), NULL); + if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key.s, "GLOBALS", sizeof("GLOBALS") - 1)) { + zend_u_hash_update(dest, key_type, string_key, string_key_len, src_entry, sizeof(zval *), NULL); } else { (*src_entry)->refcount--; } |
