]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bug in backtrack.rb
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 10 Dec 2012 18:28:52 +0000 (18:28 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 10 Dec 2012 18:28:52 +0000 (18:28 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2038 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/lib/maasha/seq/backtrack.rb

index c216ec979e0c1f15e092a1914352baa32583ff80..ead956e894661be6f3bb31e08ccbfe9ec45626f0 100644 (file)
@@ -206,24 +206,20 @@ module BackTrack
 
         char         *ss    = s;
         int           state = 0;
+        unsigned int  i     = 0;
         unsigned int  e     = 0;
         VALUE         tuple;
 
-        if (start <= stop)
-        {
-          s += start;
+        s += start;
 
-          while (*s)
+        for (i = start; i <= stop; i++, s++)
+        {
+          if ((e = backtrack(ss, s, p, mis, ins, del, state)))
           {
-            if ((e = backtrack(ss, s, p, mis, ins, del, state)))
-            {
-              tuple = rb_ary_new();
-              rb_ary_push(tuple, INT2FIX((int) (s - ss)));
-              rb_ary_push(tuple, INT2FIX((int) e - (s - ss)));
-              return tuple;
-            }
-
-            s++;
+            tuple = rb_ary_new();
+            rb_ary_push(tuple, INT2FIX((int) (s - ss)));
+            rb_ary_push(tuple, INT2FIX((int) e - (s - ss)));
+            return tuple;
           }
         }