summaryrefslogtreecommitdiff
path: root/ext/spl/spl_iterators.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/spl_iterators.c')
-rw-r--r--ext/spl/spl_iterators.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index eca51fbca3..c27d737b51 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -881,7 +881,7 @@ static union _zend_function *spl_recursive_it_get_method(zend_object **zobject,
zval *zobj;
if (!object->iterators) {
- php_error_docref(NULL, E_ERROR, "The %s instance wasn't initialized properly", (*zobject)->ce->name->val);
+ php_error_docref(NULL, E_ERROR, "The %s instance wasn't initialized properly", ZSTR_VAL((*zobject)->ce->name));
}
zobj = &object->iterators[level].zobject;
@@ -1024,15 +1024,15 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
zval has_next;
int level;
- smart_str_appendl(&str, object->prefix[0].s->val, object->prefix[0].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s));
for (level = 0; level < object->level; ++level) {
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
- smart_str_appendl(&str, object->prefix[1].s->val, object->prefix[1].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s));
} else {
- smart_str_appendl(&str, object->prefix[2].s->val, object->prefix[2].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[2].s), ZSTR_LEN(object->prefix[2].s));
}
zval_ptr_dtor(&has_next);
}
@@ -1040,14 +1040,14 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
- smart_str_appendl(&str, object->prefix[3].s->val, object->prefix[3].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s));
} else {
- smart_str_appendl(&str, object->prefix[4].s->val, object->prefix[4].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[4].s), ZSTR_LEN(object->prefix[4].s));
}
zval_ptr_dtor(&has_next);
}
- smart_str_appendl(&str, object->prefix[5].s->val, object->prefix[5].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[5].s), ZSTR_LEN(object->prefix[5].s));
smart_str_0(&str);
RETURN_NEW_STR(str.s);
@@ -1228,7 +1228,7 @@ SPL_METHOD(RecursiveTreeIterator, current)
spl_recursive_tree_iterator_get_postfix(object, &postfix);
str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix), 0);
- ptr = str->val;
+ ptr = ZSTR_VAL(str);
memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
ptr += Z_STRLEN(prefix);
@@ -1282,7 +1282,7 @@ SPL_METHOD(RecursiveTreeIterator, key)
spl_recursive_tree_iterator_get_postfix(object, &postfix);
str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix), 0);
- ptr = str->val;
+ ptr = ZSTR_VAL(str);
memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
ptr += Z_STRLEN(prefix);
@@ -1418,7 +1418,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
#define SPL_CHECK_CTOR(intern, classname) \
if (intern->dit_type == DIT_Unknown) { \
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \
- (spl_ce_##classname)->name->val, (spl_ce_##classname)->name->val); \
+ ZSTR_VAL((spl_ce_##classname)->name), ZSTR_VAL((spl_ce_##classname)->name)); \
return; \
}
@@ -1449,7 +1449,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern = Z_SPLDUAL_IT_P(getThis());
if (intern->dit_type != DIT_Unknown) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s::getIterator() must be called exactly once per instance", ce_base->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s::getIterator() must be called exactly once per instance", ZSTR_VAL(ce_base->name));
return NULL;
}
@@ -1511,7 +1511,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
return NULL;
}
if (Z_TYPE(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE(retval), zend_ce_traversable)) {
- zend_throw_exception_ex(spl_ce_LogicException, 0, "%s::getIterator() must return an object that implements Traversable", ce->name->val);
+ zend_throw_exception_ex(spl_ce_LogicException, 0, "%s::getIterator() must return an object that implements Traversable", ZSTR_VAL(ce->name));
return NULL;
}
zobject = &retval;
@@ -2040,7 +2040,7 @@ SPL_METHOD(RegexIterator, accept)
{
case REGIT_MODE_MAX: /* won't happen but makes compiler happy */
case REGIT_MODE_MATCH:
- count = pcre_exec(intern->u.regex.pce->re, intern->u.regex.pce->extra, subject->val, subject->len, 0, 0, NULL, 0);
+ count = pcre_exec(intern->u.regex.pce->re, intern->u.regex.pce->extra, ZSTR_VAL(subject), ZSTR_LEN(subject), 0, 0, NULL, 0);
RETVAL_BOOL(count >= 0);
break;
@@ -2052,7 +2052,7 @@ SPL_METHOD(RegexIterator, accept)
//??? }
zval_ptr_dtor(&intern->current.data);
ZVAL_UNDEF(&intern->current.data);
- php_pcre_match_impl(intern->u.regex.pce, subject->val, subject->len, &zcount,
+ php_pcre_match_impl(intern->u.regex.pce, ZSTR_VAL(subject), ZSTR_LEN(subject), &zcount,
&intern->current.data, intern->u.regex.mode == REGIT_MODE_ALL_MATCHES, intern->u.regex.use_flags, intern->u.regex.preg_flags, 0);
RETVAL_BOOL(Z_LVAL(zcount) > 0);
break;
@@ -2064,7 +2064,7 @@ SPL_METHOD(RegexIterator, accept)
//??? }
zval_ptr_dtor(&intern->current.data);
ZVAL_UNDEF(&intern->current.data);
- php_pcre_split_impl(intern->u.regex.pce, subject->val, subject->len, &intern->current.data, -1, intern->u.regex.preg_flags);
+ php_pcre_split_impl(intern->u.regex.pce, ZSTR_VAL(subject), ZSTR_LEN(subject), &intern->current.data, -1, intern->u.regex.preg_flags);
count = zend_hash_num_elements(Z_ARRVAL(intern->current.data));
RETVAL_BOOL(count > 1);
break;
@@ -2076,7 +2076,7 @@ SPL_METHOD(RegexIterator, accept)
convert_to_string(&tmp_replacement);
replacement = &tmp_replacement;
}
- result = php_pcre_replace_impl(intern->u.regex.pce, subject, subject->val, subject->len, replacement, 0, -1, &count);
+ result = php_pcre_replace_impl(intern->u.regex.pce, subject, ZSTR_VAL(subject), ZSTR_LEN(subject), replacement, 0, -1, &count);
if (intern->u.regex.flags & REGIT_USE_KEY) {
zval_ptr_dtor(&intern->current.key);
@@ -2780,7 +2780,7 @@ SPL_METHOD(CachingIterator, __toString)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
@@ -2810,7 +2810,7 @@ SPL_METHOD(CachingIterator, offsetSet)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
@@ -2836,7 +2836,7 @@ SPL_METHOD(CachingIterator, offsetGet)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
@@ -2845,7 +2845,7 @@ SPL_METHOD(CachingIterator, offsetGet)
}
if ((value = zend_symtable_find(HASH_OF(&intern->u.caching.zcache), key)) == NULL) {
- zend_error(E_NOTICE, "Undefined index: %s", key->val);
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(key));
return;
}
@@ -2863,7 +2863,7 @@ SPL_METHOD(CachingIterator, offsetUnset)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
@@ -2885,7 +2885,7 @@ SPL_METHOD(CachingIterator, offsetExists)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
@@ -2910,7 +2910,7 @@ SPL_METHOD(CachingIterator, getCache)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
@@ -2980,7 +2980,7 @@ SPL_METHOD(CachingIterator, count)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}