diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-10 14:00:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-10 14:00:34 +0000 |
commit | c7b454f407512be4f8ae85962e332b3a1d026c09 (patch) | |
tree | e33f1b7abaea4d85637aa3a6bd8f2e4230e03f25 /src/datacache | |
parent | ba33cac9db6e8c0c31a6b13ddb12cd4a39be5030 (diff) | |
download | gnunet-c7b454f407512be4f8ae85962e332b3a1d026c09.tar.gz gnunet-c7b454f407512be4f8ae85962e332b3a1d026c09.zip |
use LOG macro in datacache.c
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/datacache.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 43a9234e5..51d5d3423 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
30 | #include "gnunet_datacache_plugin.h" | 30 | #include "gnunet_datacache_plugin.h" |
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "datacache", __VA_ARGS__) | ||
33 | |||
32 | /** | 34 | /** |
33 | * Internal state of the datacache library. | 35 | * Internal state of the datacache library. |
34 | */ | 36 | */ |
@@ -130,17 +132,16 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
130 | if (GNUNET_OK != | 132 | if (GNUNET_OK != |
131 | GNUNET_CONFIGURATION_get_value_number (cfg, section, "QUOTA", "a)) | 133 | GNUNET_CONFIGURATION_get_value_number (cfg, section, "QUOTA", "a)) |
132 | { | 134 | { |
133 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 135 | LOG (GNUNET_ERROR_TYPE_ERROR, |
134 | _("No `%s' specified for `%s' in configuration!\n"), "QUOTA", | 136 | _("No `%s' specified for `%s' in configuration!\n"), "QUOTA", section); |
135 | section); | ||
136 | return NULL; | 137 | return NULL; |
137 | } | 138 | } |
138 | if (GNUNET_OK != | 139 | if (GNUNET_OK != |
139 | GNUNET_CONFIGURATION_get_value_string (cfg, section, "DATABASE", &name)) | 140 | GNUNET_CONFIGURATION_get_value_string (cfg, section, "DATABASE", &name)) |
140 | { | 141 | { |
141 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 142 | LOG (GNUNET_ERROR_TYPE_ERROR, |
142 | _("No `%s' specified for `%s' in configuration!\n"), "DATABASE", | 143 | _("No `%s' specified for `%s' in configuration!\n"), "DATABASE", |
143 | section); | 144 | section); |
144 | return NULL; | 145 | return NULL; |
145 | } | 146 | } |
146 | bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ | 147 | bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ |
@@ -164,16 +165,15 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
164 | ret->env.cls = ret; | 165 | ret->env.cls = ret; |
165 | ret->env.delete_notify = &env_delete_notify; | 166 | ret->env.delete_notify = &env_delete_notify; |
166 | ret->env.quota = quota; | 167 | ret->env.quota = quota; |
167 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading `%s' datacache plugin\n"), | 168 | LOG (GNUNET_ERROR_TYPE_INFO, _("Loading `%s' datacache plugin\n"), name); |
168 | name); | ||
169 | GNUNET_asprintf (&libname, "libgnunet_plugin_datacache_%s", name); | 169 | GNUNET_asprintf (&libname, "libgnunet_plugin_datacache_%s", name); |
170 | ret->short_name = name; | 170 | ret->short_name = name; |
171 | ret->lib_name = libname; | 171 | ret->lib_name = libname; |
172 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); | 172 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); |
173 | if (ret->api == NULL) | 173 | if (ret->api == NULL) |
174 | { | 174 | { |
175 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 175 | LOG (GNUNET_ERROR_TYPE_ERROR, |
176 | _("Failed to load datacache plugin for `%s'\n"), name); | 176 | _("Failed to load datacache plugin for `%s'\n"), name); |
177 | GNUNET_DATACACHE_destroy (ret); | 177 | GNUNET_DATACACHE_destroy (ret); |
178 | return NULL; | 178 | return NULL; |
179 | } | 179 | } |
@@ -199,8 +199,8 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h) | |||
199 | if (h->bloom_name != NULL) | 199 | if (h->bloom_name != NULL) |
200 | { | 200 | { |
201 | if (0 != UNLINK (h->bloom_name)) | 201 | if (0 != UNLINK (h->bloom_name)) |
202 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", | 202 | GNUNET_log_from_strerror_file (GNUNET_ERROR_TYPE_WARNING, "datacache", |
203 | h->bloom_name); | 203 | "unlink", h->bloom_name); |
204 | GNUNET_free (h->bloom_name); | 204 | GNUNET_free (h->bloom_name); |
205 | } | 205 | } |
206 | GNUNET_STATISTICS_destroy (h->stats, GNUNET_NO); | 206 | GNUNET_STATISTICS_destroy (h->stats, GNUNET_NO); |
@@ -237,7 +237,7 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
237 | GNUNET_NO); | 237 | GNUNET_NO); |
238 | GNUNET_CONTAINER_bloomfilter_add (h->filter, key); | 238 | GNUNET_CONTAINER_bloomfilter_add (h->filter, key); |
239 | while (h->utilization + used > h->env.quota) | 239 | while (h->utilization + used > h->env.quota) |
240 | GNUNET_assert (GNUNET_OK == h->api->del (h->api->cls)); | 240 | GNUNET_assert (GNUNET_OK == h->api->del (h->api->cls)); |
241 | h->utilization += used; | 241 | h->utilization += used; |
242 | return GNUNET_OK; | 242 | return GNUNET_OK; |
243 | } | 243 | } |