summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-06-29 18:45:14 +0800
committerXinchen Hui <laruence@php.net>2014-06-29 19:01:02 +0800
commit477f565f80c0c396a99903081851ea6bf2223e0f (patch)
treeef3a760234a08a8866915edf56e064f5132a7b2b
parentf2c83b774ae3fb101e000df16eeefbe59ba4a318 (diff)
downloadphp-git-477f565f80c0c396a99903081851ea6bf2223e0f.tar.gz
Fixed collator_sort
-rw-r--r--ext/intl/collator/collator_convert.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index de5d4adbab..5827e4ee53 100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
@@ -41,19 +41,15 @@
/* {{{ collator_convert_hash_item_from_utf8_to_utf16 */
static void collator_convert_hash_item_from_utf8_to_utf16(
- HashTable* hash, zend_string *hashKey, ulong hashIndex,
+ HashTable* hash, zval *hashData, zend_string *hashKey, ulong hashIndex,
UErrorCode* status )
{
const char* old_val;
int old_val_len;
UChar* new_val = NULL;
int new_val_len = 0;
- zval* hashData = NULL;
zval znew_val;
- /* Get current hash item. */
- hashData = zend_hash_get_current_data( hash );
-
/* Process string values only. */
if( Z_TYPE_P( hashData ) != IS_STRING )
return;
@@ -84,19 +80,15 @@ static void collator_convert_hash_item_from_utf8_to_utf16(
/* {{{ collator_convert_hash_item_from_utf16_to_utf8 */
static void collator_convert_hash_item_from_utf16_to_utf8(
- HashTable* hash, zend_string* hashKey, ulong hashIndex,
+ HashTable* hash, zval * hashData, zend_string* hashKey, ulong hashIndex,
UErrorCode* status )
{
const char* old_val;
int old_val_len;
char* new_val = NULL;
int new_val_len = 0;
- zval* hashData = NULL;
zval znew_val;
- /* Get current hash item. */
- hashData = zend_hash_get_current_data( hash );
-
/* Process string values only. */
if( Z_TYPE_P( hashData ) != IS_STRING )
return;
@@ -132,12 +124,13 @@ static void collator_convert_hash_item_from_utf16_to_utf8(
void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* status )
{
ulong hashIndex;
+ zval *hashData;
zend_string *hashKey;
- ZEND_HASH_FOREACH_KEY(hash, hashIndex, hashKey) {
+ ZEND_HASH_FOREACH_KEY_VAL(hash, hashIndex, hashKey, hashData) {
/* Convert current hash item from UTF-8 to UTF-16LE. */
collator_convert_hash_item_from_utf8_to_utf16(
- hash, hashKey, hashIndex, status );
+ hash, hashData, hashKey, hashIndex, status );
if( U_FAILURE( *status ) )
return;
} ZEND_HASH_FOREACH_END();
@@ -151,11 +144,12 @@ void collator_convert_hash_from_utf16_to_utf8( HashTable* hash, UErrorCode* stat
{
ulong hashIndex;
zend_string *hashKey;
+ zval *hashData;
- ZEND_HASH_FOREACH_KEY(hash, hashIndex, hashKey) {
+ ZEND_HASH_FOREACH_KEY_VAL(hash, hashIndex, hashKey, hashData) {
/* Convert current hash item from UTF-16LE to UTF-8. */
collator_convert_hash_item_from_utf16_to_utf8(
- hash, hashKey, hashIndex, status );
+ hash, hashData, hashKey, hashIndex, status );
if( U_FAILURE( *status ) ) {
return;
}