aboutsummaryrefslogtreecommitdiff
path: root/src/statistics
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-05-06 18:24:05 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-05-06 18:24:05 +0000
commitf1663ffa788ec7bc02f37e1de9ae9d41efb7ea7e (patch)
treed4e617a43badc81cca4e45d88770e136ee538a75 /src/statistics
parenta0c3ddffa12f7d6e0bfbad3cfd412c3fbd76e996 (diff)
-cleaner
git-svn-id: https://gnunet.org/svn/gnunet@21303 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/statistics')
-rw-r--r--src/statistics/gnunet-statistics.c20
-rw-r--r--src/statistics/statistics_api.c8
2 files changed, 20 insertions, 8 deletions
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index 8b163ef899..85d8b8c4da 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -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;
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c
index 6ce10421a5..85eb569eb6 100644
--- a/src/statistics/statistics_api.c
+++ b/src/statistics/statistics_api.c
@@ -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))