Added recursivetreeiterator::setPostfix() method #99

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

@jaytaph
Contributor
jaytaph commented Jun 2, 2012

Added a recursivetreeiterator::setPostfix method since it was not present. The getPostFix() method returns the string as set through this method, and the current() method will add the postfix to the actual current value (as stated in the documentation).

@smalyshev smalyshev commented on the diff Aug 20, 2012
ext/spl/spl_iterators.c
@@ -1039,7 +1044,11 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje
static void spl_recursive_tree_iterator_get_postfix(spl_recursive_it_object * object, zval * return_value TSRMLS_DC)
{
- RETVAL_STRINGL("", 0, 1);
+ smart_str str = {0};
+ smart_str_appendl(&str, object->postfix[0].c, object->postfix[0].len);
+ smart_str_0(&str);
+
+ RETVAL_STRINGL(str.c, str.len, 0);
@smalyshev
smalyshev Aug 20, 2012 Contributor

Why can't you just return a copy of object->postfix[0].c?

@jaytaph
jaytaph Aug 20, 2012 Contributor

In this case, you could. The code is pretty much taken from the get_prefix() to make it easier to implement the same structure as the prefix in a later stage.

@lstrojny
Contributor

@jaytaph could you copy object->postfix[0].c. Otherwise the patch looks good.

@lstrojny
Contributor
lstrojny commented Jan 6, 2013

@jaytaph ping

@lstrojny
Contributor

@jaytaph ping again

@jaytaph
Contributor
jaytaph commented Jan 14, 2013

sorry.. extremely busy right now.. will change the patch as soon as I can find some spare time..

@php-pulls

Comment on behalf of stas at php.net:

merged

@php-pulls php-pulls closed this Jul 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment