-cleaner
authorChristian Grothoff <christian@grothoff.org>
Sun, 6 May 2012 18:24:05 +0000 (18:24 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 6 May 2012 18:24:05 +0000 (18:24 +0000)
src/statistics/gnunet-statistics.c
src/statistics/statistics_api.c

index 8b163ef899264fba48b69a3669076cdbefb7e274..85d8b8c4da9310984b793da9f4f210024fe7bc95 100644 (file)
@@ -62,6 +62,7 @@ static int watch;
  */
 static int quiet;
 
+
 /**
  * Callback function to process statistic values.
  *
@@ -103,18 +104,28 @@ cleanup (void *cls, int success)
     FPRINTF (stderr, "%s", _("Failed to obtain statistics.\n"));
     ret = 1;
   }
-  if (h != NULL)
+  if (NULL != h)
+  {
     GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+    h = NULL;
+  }
 }
+
+
 static void
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_STATISTICS_Handle *h = cls;
+
   GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h);
-  if (h != NULL)
+  if (NULL != h)
+  {
     GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+    h = NULL;
+  }
 }
 
+
 /**
  * Main function that will be run by the scheduler.
  *
@@ -140,17 +151,18 @@ run (void *cls, char *const *args, const char *cfgfile,
       return;
     }
     h = GNUNET_STATISTICS_create (subsystem, cfg);
-    if (h == NULL)
+    if (NULL == h)
     {
       ret = 1;
       return;
     }
     GNUNET_STATISTICS_set (h, name, (uint64_t) val, persistent);
     GNUNET_STATISTICS_destroy (h, GNUNET_YES);
+    h = NULL;
     return;
   }
   h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg);
-  if (h == NULL)
+  if (NULL == h)
   {
     ret = 1;
     return;
index 6ce10421a58d413b00f479afc63ebeeaada9ae0c..85eb569eb6712f34cfd588da782e3d3a60cfe86d 100644 (file)
@@ -412,7 +412,6 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 }
 
 
-
 /**
  * Task used by 'reconnect_later' to shutdown the handle
  *
@@ -428,6 +427,7 @@ do_destroy (void *cls,
   GNUNET_STATISTICS_destroy (h, GNUNET_NO);
 }
 
+
 /**
  * Reconnect at a later time, respecting back-off.
  *
@@ -911,7 +911,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
   }
   if (sync_first)
   {
-    if (h->current != NULL)
+    if (NULL != h->current)
     {
       if (h->current->type == ACTION_GET)
       {
@@ -947,9 +947,9 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
        GNUNET_CLIENT_notify_transmit_ready (h->client, h->current->msize,
                                             timeout, GNUNET_YES,
                                             &transmit_action, h);
-      GNUNET_assert (NULL != h->th);      
+      GNUNET_assert (NULL != h->th);
     }
-    if (h->th != NULL)
+    if (NULL != h->th)
       return; /* do not finish destruction just yet */
   }
   while (NULL != (pos = h->action_head))