Skip to content
Browse files

Sereal::Path::Tie: remove confusing stack_ptr

1 parent 1db3323 commit f2d3429e136bd3f56df9c4ebf7dbd7ccb58047ff @ikruglov ikruglov committed May 26, 2016
Showing with 3 additions and 7 deletions.
  1. +3 −7 Perl/Path/Tie.xs
View
10 Perl/Path/Tie.xs
@@ -172,7 +172,6 @@ FETCH(this, key)
I32 key;
PREINIT:
IV idx;
- srl_iterator_stack_ptr stack_ptr;
SV **svptr;
PPCODE:
if (this->store != NULL) {
@@ -188,9 +187,9 @@ FETCH(this, key)
if (idx == SRL_ITER_NOT_FOUND) {
ST(0) = &PL_sv_undef;
} else {
- stack_ptr = srl_iterator_stack(aTHX_ this->iter);
- if ((stack_ptr->length - idx) > stack_ptr->ridx)
+ if (idx < srl_iterator_stack_index(aTHX_ this->iter)) {
srl_iterator_rewind(aTHX_ this->iter, 0);
+ }
srl_iterator_array_goto(aTHX_ this->iter, key);
ST(0) = srl_tie_new_tied_sv(aTHX_ this->iter, this->iter_sv);
@@ -355,17 +354,14 @@ void
NEXTKEY(this, last)
sereal_iterator_tied_hash_t *this;
SV *last;
- PREINIT:
- UV cur_stack_index;
PPCODE:
this->cur_idx += 2;
if (this->cur_idx >= 2*this->count) {
ST(0) = &PL_sv_undef;
} else {
srl_tie_goto_depth_and_maybe_copy_iterator(aTHX_ (sereal_iterator_tied_t*) this);
- cur_stack_index = srl_iterator_stack_index(this->iter);
- if (this->cur_idx < cur_stack_index) {
+ if (this->cur_idx < srl_iterator_stack_index(aTHX_ this->iter)) {
srl_iterator_rewind(aTHX_ this->iter, 0);
}

0 comments on commit f2d3429

Please sign in to comment.
Something went wrong with that request. Please try again.