gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35171 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r35171 - gnunet/src/ats
Date: Sun, 8 Feb 2015 18:40:57 +0100

Author: grothoff
Date: 2015-02-08 18:40:57 +0100 (Sun, 08 Feb 2015)
New Revision: 35171

Modified:
   gnunet/src/ats/plugin_ats_proportional.c
Log:
-simplify logic, convert breaks into asserts

Modified: gnunet/src/ats/plugin_ats_proportional.c
===================================================================
--- gnunet/src/ats/plugin_ats_proportional.c    2015-02-08 17:34:33 UTC (rev 
35170)
+++ gnunet/src/ats/plugin_ats_proportional.c    2015-02-08 17:40:57 UTC (rev 
35171)
@@ -840,7 +840,7 @@
 
 
 /**
- * Decrease address count in network
+ * Decrease number of active addresses in network.
  *
  * @param s the solver handle
  * @param net the network type
@@ -849,28 +849,18 @@
 address_decrement_active (struct GAS_PROPORTIONAL_Handle *s,
                           struct Network *net)
 {
-  if (net->active_addresses < 1)
-  {
-    GNUNET_break (0);
-  }
-  else
-  {
-    net->active_addresses--;
-    GNUNET_STATISTICS_update (s->env->stats,
-                              net->stat_active, -1, GNUNET_NO);
-  }
-  if (s->active_addresses < 1)
-  {
-    GNUNET_break (0);
-  }
-  else
-  {
-    s->active_addresses--;
-    GNUNET_STATISTICS_update (s->env->stats,
-                              "# ATS addresses total",
-                              -1,
-                              GNUNET_NO);
-  }
+  GNUNET_assert (net->active_addresses > 0);
+  net->active_addresses--;
+  GNUNET_STATISTICS_update (s->env->stats,
+                            net->stat_active,
+                            -1,
+                            GNUNET_NO);
+  GNUNET_assert (s->active_addresses > 0);
+  s->active_addresses--;
+  GNUNET_STATISTICS_update (s->env->stats,
+                            "# ATS addresses total",
+                            -1,
+                            GNUNET_NO);
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]