diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-06 18:24:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-06 18:24:05 +0000 |
commit | e6b55e45670cb905a1fff70fbdbc48809a41315e (patch) | |
tree | d4e617a43badc81cca4e45d88770e136ee538a75 /src/statistics/gnunet-statistics.c | |
parent | 4dbc295056fa19607cace8d0ea47857b03e01b28 (diff) | |
download | gnunet-e6b55e45670cb905a1fff70fbdbc48809a41315e.tar.gz gnunet-e6b55e45670cb905a1fff70fbdbc48809a41315e.zip |
-cleaner
Diffstat (limited to 'src/statistics/gnunet-statistics.c')
-rw-r--r-- | src/statistics/gnunet-statistics.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index 8b163ef89..85d8b8c4d 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -62,6 +62,7 @@ static int watch; | |||
62 | */ | 62 | */ |
63 | static int quiet; | 63 | static int quiet; |
64 | 64 | ||
65 | |||
65 | /** | 66 | /** |
66 | * Callback function to process statistic values. | 67 | * Callback function to process statistic values. |
67 | * | 68 | * |
@@ -103,18 +104,28 @@ cleanup (void *cls, int success) | |||
103 | FPRINTF (stderr, "%s", _("Failed to obtain statistics.\n")); | 104 | FPRINTF (stderr, "%s", _("Failed to obtain statistics.\n")); |
104 | ret = 1; | 105 | ret = 1; |
105 | } | 106 | } |
106 | if (h != NULL) | 107 | if (NULL != h) |
108 | { | ||
107 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); | 109 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); |
110 | h = NULL; | ||
111 | } | ||
108 | } | 112 | } |
113 | |||
114 | |||
109 | static void | 115 | static void |
110 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 116 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
111 | { | 117 | { |
112 | struct GNUNET_STATISTICS_Handle *h = cls; | 118 | struct GNUNET_STATISTICS_Handle *h = cls; |
119 | |||
113 | GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h); | 120 | GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h); |
114 | if (h != NULL) | 121 | if (NULL != h) |
122 | { | ||
115 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); | 123 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); |
124 | h = NULL; | ||
125 | } | ||
116 | } | 126 | } |
117 | 127 | ||
128 | |||
118 | /** | 129 | /** |
119 | * Main function that will be run by the scheduler. | 130 | * Main function that will be run by the scheduler. |
120 | * | 131 | * |
@@ -140,17 +151,18 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
140 | return; | 151 | return; |
141 | } | 152 | } |
142 | h = GNUNET_STATISTICS_create (subsystem, cfg); | 153 | h = GNUNET_STATISTICS_create (subsystem, cfg); |
143 | if (h == NULL) | 154 | if (NULL == h) |
144 | { | 155 | { |
145 | ret = 1; | 156 | ret = 1; |
146 | return; | 157 | return; |
147 | } | 158 | } |
148 | GNUNET_STATISTICS_set (h, name, (uint64_t) val, persistent); | 159 | GNUNET_STATISTICS_set (h, name, (uint64_t) val, persistent); |
149 | GNUNET_STATISTICS_destroy (h, GNUNET_YES); | 160 | GNUNET_STATISTICS_destroy (h, GNUNET_YES); |
161 | h = NULL; | ||
150 | return; | 162 | return; |
151 | } | 163 | } |
152 | h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg); | 164 | h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg); |
153 | if (h == NULL) | 165 | if (NULL == h) |
154 | { | 166 | { |
155 | ret = 1; | 167 | ret = 1; |
156 | return; | 168 | return; |