copelnug / duplicate-contact-manager-for-thundebird

Automatically exported from code.google.com/p/duplicate-contact-manager-for-thundebird
2 stars 0 forks source link

Possible Recursion Fix #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
0.6 on Windows XP SP2/SP3

Please provide any additional information below.

The skipPositionsToNext function has no local/internal variables/values.
Therefore, it probably does not require recursion at all.
How about a clean loop?
*********************************************************
    /**
     * increments internal pointers to next available card pair.
     * Returns true if next pair is found.
     * Returns false if no next pair is available
     */
    skipPositionsToNext: function() {

        retval: true;

        for (;;)
        {
            this.currentSearchPairPosition++;
            if (this.currentSearchPairPosition == this.vcards.length) {
                this.currentSearchPairPosition = 0;
                this.currentSearchPosition++;
                if (this.currentSearchPosition >= this.vcards.length) {
                    // end of material.
                    //alert('end of material.');
                    retval = false;
                    break;
                }
            }

            if !(
                (this.currentSearchPosition == this.currentSearchPairPosition) ||
                this.deletedCards[this.currentSearchPosition] ||
                this.deletedCards[this.currentSearchPairPosition] ||

this.duplicateCache[this.currentSearchPosition+'_'+this.currentSearchPairPositio
n]
            )
            {
                break;
            }
        }

        return retval;
    },
***************************************************

Steven

Original issue reported on code.google.com by sger...@gerber-systems.com on 13 Oct 2008 at 7:24

GoogleCodeExporter commented 9 years ago
Fixed on the svn. 

Could also create a bug when the recursive call return false because the 
function do not return the same.

Original comment by Copel...@gmail.com on 3 Jul 2010 at 8:12