]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
Fixed bug in evaluation of return value in gavl_search_node() function.
authorppisa <ppisa>
Thu, 9 Dec 2004 00:24:27 +0000 (00:24 +0000)
committerppisa <ppisa>
Thu, 9 Dec 2004 00:24:27 +0000 (00:24 +0000)
Bug reported by Neal H. Walfield. It slipped into code
23 Oct 2003 and has been unnoticed until now, because all CAN
code switched to custom tree version before bug introduction.

ulut/ul_gavl.c
ulut/ul_gavlchk.c

index 88e714adb9b298fd58a3e11f65a9b9f121536ae2..1ecf029fe9cafd5297d428b65e3fbd88f9dc83f4 100644 (file)
@@ -150,7 +150,7 @@ gavl_search_node(const gavl_root_t *root, const void *key,
     cmp=0;
   }
   *nodep=p;
-  return cmp;
+  return (mode&GAVL_FCMP)?cmp:1;
 }
 
 /**
index 45b9dd61b58dbe0ae353c3c05b7c76d673f295a8..239385329c8ad995176e6f695dd141885e91b46e 100644 (file)
@@ -335,7 +335,7 @@ void cust_timing_test(void)
 {
   int i;
   int items_cnt=100000;
-  cust2_item_t *items;
+  cust2_item_t *items, *item;
   struct timeval time_start, time_stop;
 
   printf("\nRunning custom tree timing test for %d items\n",items_cnt);
@@ -361,8 +361,11 @@ void cust_timing_test(void)
   
   gettimeofday(&time_start,NULL);
   for(i=0;i<items_cnt;i++){
-    if(!cust2_find(&cust2_root,&i))
+    if(!(item=cust2_find(&cust2_root,&i)))
       printf("cust2_find error\n");
+    else 
+      if(item->my_val!=i)
+        printf("gavl_find mismatch\n");
   }
   gettimeofday(&time_stop,NULL);
   timing_test_print(&time_start,&time_stop,"cust find");