Commits

Anonymous committed a638130

Refactored _become_default().

Comments (0)

Files changed (2)

     - Optimization/Refactoring: replaced the last call to ->_father with a 
     call to _current_father(). Removed ->_father and optimized
     _current_father() .
+    - Optimization/Refactoring: refactored _become_default() to remove
+    the execessive use of $father and $father->idx(). Now ->idx() is
+    no longer needed and will be removed next.
 
 0.1.7 - Thu Jan 15 16:09:49 IST 2009
     - Fixed the check-for-link and for directory semantics on Windows

lib/File/Find/Object.pm

 {
     my $self = shift;
 
-    my $father = $self->_current_father;
-
     my $st = $self->_dir_stack();
 
-    if ($father->idx == 0)
+    pop(@$st);
+    $self->_current($st->[-1]);
+
+    if (@$st == 1)
     {
-        splice(@$st, 1);
-        $self->_current($st->[-1]);
         delete($self->{_st});
     }
     else
     {
-        splice(@$st, $father->idx()+1);
-        splice(@{$self->_curr_comps()}, $father->idx()+1);
-        $self->_current($st->[-1]);
+        pop(@{$self->_curr_comps()});
         
         # If depth is false, then we no longer need the _curr_path
         # of the directories above the previously-set value, because we