summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-03-22 08:32:53 +0100
committerOndřej Surý <ondrej@sury.org>2013-03-22 08:32:53 +0100
commitf21eff8954d5956842795ea5653a9a5b8d62caa3 (patch)
treeadbe3c3feb67f383afe32b3974794eb1d5ec8cc8 /ext/intl
parent92984f18f6aee9c0f719febb9fc09a0c50262c2f (diff)
downloadphp-f21eff8954d5956842795ea5653a9a5b8d62caa3.tar.gz
Imported Upstream version 5.5.0~beta1upstream/5.5.0_beta1
Diffstat (limited to 'ext/intl')
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp10
-rw-r--r--ext/intl/common/common_enum.cpp14
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.c13
3 files changed, 9 insertions, 28 deletions
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index d88ad8a71..3748991ae 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -139,14 +139,10 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC
zval_ptr_dtor(reinterpret_cast<zval**>(&iter->data));
}
-static int _breakiterator_parts_get_current_key(zend_object_iterator *iter,
- char **str_key,
- uint *str_key_len,
- ulong *int_key TSRMLS_DC)
+static void _breakiterator_parts_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{
/* the actual work is done in move_forward and rewind */
- *int_key = iter->index;
- return HASH_KEY_IS_LONG;
+ ZVAL_LONG(key, iter->index);
}
static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC)
@@ -343,4 +339,4 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D)
PARTSITER_DECL_LONG_CONST(KEY_RIGHT);
#undef PARTSITER_DECL_LONG_CONST
-} \ No newline at end of file
+}
diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp
index da47a437a..3ba785582 100644
--- a/ext/intl/common/common_enum.cpp
+++ b/ext/intl/common/common_enum.cpp
@@ -251,19 +251,7 @@ static PHP_METHOD(IntlIterator, key)
INTLITERATOR_METHOD_FETCH_OBJECT;
if (ii->iterator->funcs->get_current_key) {
- char *str_key;
- uint str_key_len;
- ulong int_key;
-
- switch (ii->iterator->funcs->get_current_key(
- ii->iterator, &str_key, &str_key_len, &int_key TSRMLS_CC)) {
- case HASH_KEY_IS_LONG:
- RETURN_LONG(int_key);
- break;
- case HASH_KEY_IS_STRING:
- RETURN_STRINGL(str_key, str_key_len-1, 0);
- break;
- }
+ ii->iterator->funcs->get_current_key(ii->iterator, return_value TSRMLS_CC);
} else {
RETURN_LONG(ii->iterator->index);
}
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c
index 16e1b9287..78236fda5 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.c
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.c
@@ -101,21 +101,18 @@ static void resourcebundle_iterator_current( zend_object_iterator *iter, zval **
/* }}} */
/* {{{ resourcebundle_iterator_key */
-static int resourcebundle_iterator_key( zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC )
+static void resourcebundle_iterator_key( zend_object_iterator *iter, zval *key TSRMLS_DC )
{
ResourceBundle_iterator *iterator = (ResourceBundle_iterator *) iter;
if (!iterator->current) {
resourcebundle_iterator_read( iterator TSRMLS_CC);
}
+
if (iterator->is_table) {
- *str_key = estrdup( iterator->currentkey );
- *str_key_len = strlen( iterator->currentkey ) + 1;
- return HASH_KEY_IS_STRING;
- }
- else {
- *int_key = iterator->i;
- return HASH_KEY_IS_LONG;
+ ZVAL_STRING(key, iterator->currentkey, 1);
+ } else {
+ ZVAL_LONG(key, iterator->i);
}
}
/* }}} */