]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
Corrected bug in gavl_find_after() found by Martin Molnar.
authorppisa <ppisa>
Fri, 29 Feb 2008 11:04:50 +0000 (11:04 +0000)
committerppisa <ppisa>
Fri, 29 Feb 2008 11:04:50 +0000 (11:04 +0000)
Added test option 'S' to check this function in "ul_gavlchk.c".

ulut/ul_gavl.c
ulut/ul_gavlchk.c

index 1ecf029fe9cafd5297d428b65e3fbd88f9dc83f4..d290dfc5f31220755c7a0a9e3b90c3f898f3d3ce 100644 (file)
@@ -198,7 +198,7 @@ void *
 gavl_find_after(const gavl_root_t *root, const void *key)
 {
   gavl_node_t *n;
-  n=gavl_find_after(root, key);
+  n=gavl_find_after_node(root, key);
   return n?gavl_node2item(root,n):NULL;
 }
 
index 239385329c8ad995176e6f695dd141885e91b46e..36f818f61fc0d168c0e46dd5991daff9b2e48c93 100644 (file)
@@ -596,6 +596,20 @@ int main(int argc, char *argv[])
          gavl_print_tree1(&test_gavl1, test_gavl1.root_node, 0, NULL, 0);
         }
        break;
+      case 'S':
+        if (scanf("%d",&val)==1){
+         item=gavl_find_first(&test_gavl1, &val);
+         if(item)
+           printf("gavl_find_first find item with value %d\n", item->val);
+         else
+           printf("gavl_find_first found no item\n");
+         item=gavl_find_after(&test_gavl1, &val);
+         if(item)
+           printf("gavl_find_after find item with value %d\n", item->val);
+         else
+           printf("gavl_find_after found no item\n");
+        }
+       break;
       case 'f':
        gavl_foreach_test1(&test_gavl1);
        break;