Fixed false positives when assert()ing.
authorThomas Lopatic <thomas@lopatic.de>
Mon, 28 Feb 2005 14:42:57 +0000 (14:42 +0000)
committerThomas Lopatic <thomas@lopatic.de>
Mon, 28 Feb 2005 14:42:57 +0000 (14:42 +0000)
src/process_routes.c

index a6966a1..7c6b7fb 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: process_routes.c,v 1.23 2005/02/28 09:52:13 kattemat Exp $
+ * $Id: process_routes.c,v 1.24 2005/02/28 14:42:57 tlopatic Exp $
  */
 
 
@@ -315,6 +315,8 @@ olsr_delete_routes_from_kernel(struct destination_n *delete_kernel_list)
     {
       struct destination_n *previous_node = delete_kernel_list;
 
+      assert(metric_counter);
+
       /* searching for all the items with metric equal to n */
       for(destination_ptr = delete_kernel_list; destination_ptr != NULL; )
        {
@@ -372,8 +374,6 @@ olsr_delete_routes_from_kernel(struct destination_n *delete_kernel_list)
         {
          metric_counter--;
         }
-
-      assert(metric_counter);
     }
  
 }
@@ -398,6 +398,8 @@ olsr_add_routes_in_kernel(struct destination_n *add_kernel_list)
       struct destination_n *destination_kernel = NULL;
       struct destination_n *previous_node = add_kernel_list;
 
+      assert(metric_counter < HOPCNT_MAX);
+
       /* searching for all the items with metric equal to n */
       for(destination_kernel = add_kernel_list; destination_kernel != NULL; )
        {
@@ -456,8 +458,6 @@ olsr_add_routes_in_kernel(struct destination_n *add_kernel_list)
         {
          metric_counter++;
         }
-
-      assert(metric_counter < HOPCNT_MAX);
     }
        
 }