diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
commit | 61c39c60565b386e0e12ea669556b030e8cd7180 (patch) | |
tree | 59109aeab8297bdc996faca8c4e38ec7426c36cf /src/datacache | |
parent | 780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff) | |
download | gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip |
-remove trailing whitespace
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/datacache.c | 12 | ||||
-rw-r--r-- | src/datacache/perf_datacache.c | 2 | ||||
-rw-r--r-- | src/datacache/plugin_datacache_heap.c | 18 | ||||
-rw-r--r-- | src/datacache/plugin_datacache_postgres.c | 20 | ||||
-rw-r--r-- | src/datacache/plugin_datacache_sqlite.c | 12 | ||||
-rw-r--r-- | src/datacache/test_datacache.c | 8 |
6 files changed, 36 insertions, 36 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 848979979..e6b49fd75 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -154,7 +154,7 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
154 | bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ | 154 | bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ |
155 | 155 | ||
156 | ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle)); | 156 | ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle)); |
157 | 157 | ||
158 | if (GNUNET_YES != | 158 | if (GNUNET_YES != |
159 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF")) | 159 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF")) |
160 | { | 160 | { |
@@ -166,12 +166,12 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
166 | if (NULL != ret->bloom_name) | 166 | if (NULL != ret->bloom_name) |
167 | { | 167 | { |
168 | ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */ | 168 | ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */ |
169 | 5); | 169 | 5); |
170 | } | 170 | } |
171 | if (NULL == ret->filter) | 171 | if (NULL == ret->filter) |
172 | { | 172 | { |
173 | ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */ | 173 | ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */ |
174 | } | 174 | } |
175 | } | 175 | } |
176 | ret->stats = GNUNET_STATISTICS_create ("datacache", cfg); | 176 | ret->stats = GNUNET_STATISTICS_create ("datacache", cfg); |
177 | ret->section = GNUNET_strdup (section); | 177 | ret->section = GNUNET_strdup (section); |
@@ -247,8 +247,8 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
247 | { | 247 | { |
248 | ssize_t used; | 248 | ssize_t used; |
249 | 249 | ||
250 | used = h->api->put (h->api->cls, key, | 250 | used = h->api->put (h->api->cls, key, |
251 | size, data, | 251 | size, data, |
252 | type, discard_time, | 252 | type, discard_time, |
253 | path_info_len, path_info); | 253 | path_info_len, path_info); |
254 | if (-1 == used) | 254 | if (-1 == used) |
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c index 027999d22..e422f91ca 100644 --- a/src/datacache/perf_datacache.c +++ b/src/datacache/perf_datacache.c | |||
@@ -44,7 +44,7 @@ static const char *plugin_name; | |||
44 | 44 | ||
45 | 45 | ||
46 | static int | 46 | static int |
47 | checkIt (void *cls, | 47 | checkIt (void *cls, |
48 | const struct GNUNET_HashCode * key, size_t size, const char *data, | 48 | const struct GNUNET_HashCode * key, size_t size, const char *data, |
49 | enum GNUNET_BLOCK_Type type, | 49 | enum GNUNET_BLOCK_Type type, |
50 | struct GNUNET_TIME_Absolute exp, | 50 | struct GNUNET_TIME_Absolute exp, |
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index aee6cd5b8..e930705f2 100644 --- a/src/datacache/plugin_datacache_heap.c +++ b/src/datacache/plugin_datacache_heap.c | |||
@@ -95,7 +95,7 @@ struct Value | |||
95 | * Type of the block. | 95 | * Type of the block. |
96 | */ | 96 | */ |
97 | enum GNUNET_BLOCK_Type type; | 97 | enum GNUNET_BLOCK_Type type; |
98 | 98 | ||
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
@@ -110,7 +110,7 @@ struct PutContext | |||
110 | /** | 110 | /** |
111 | * Expiration time for the new value. | 111 | * Expiration time for the new value. |
112 | */ | 112 | */ |
113 | struct GNUNET_TIME_Absolute discard_time; | 113 | struct GNUNET_TIME_Absolute discard_time; |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Data for the new value. | 116 | * Data for the new value. |
@@ -155,7 +155,7 @@ struct PutContext | |||
155 | * | 155 | * |
156 | * @param cls the 'struct PutContext' | 156 | * @param cls the 'struct PutContext' |
157 | * @param key the key for the value(s) | 157 | * @param key the key for the value(s) |
158 | * @param value an existing value | 158 | * @param value an existing value |
159 | * @return GNUNET_YES if not found (to continue to iterate) | 159 | * @return GNUNET_YES if not found (to continue to iterate) |
160 | */ | 160 | */ |
161 | static int | 161 | static int |
@@ -170,16 +170,16 @@ put_cb (void *cls, | |||
170 | (val->type == put_ctx->type) && | 170 | (val->type == put_ctx->type) && |
171 | (0 == memcmp (&val[1], put_ctx->data, put_ctx->size)) ) | 171 | (0 == memcmp (&val[1], put_ctx->data, put_ctx->size)) ) |
172 | { | 172 | { |
173 | put_ctx->found = GNUNET_YES; | 173 | put_ctx->found = GNUNET_YES; |
174 | val->discard_time = GNUNET_TIME_absolute_max (val->discard_time, | 174 | val->discard_time = GNUNET_TIME_absolute_max (val->discard_time, |
175 | put_ctx->discard_time); | 175 | put_ctx->discard_time); |
176 | /* replace old path with new path */ | 176 | /* replace old path with new path */ |
177 | GNUNET_array_grow (val->path_info, | 177 | GNUNET_array_grow (val->path_info, |
178 | val->path_info_len, | 178 | val->path_info_len, |
179 | put_ctx->path_info_len); | 179 | put_ctx->path_info_len); |
180 | memcpy (val->path_info, | 180 | memcpy (val->path_info, |
181 | put_ctx->path_info, | 181 | put_ctx->path_info, |
182 | put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); | 182 | put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); |
183 | GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, | 183 | GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, |
184 | val->hn, | 184 | val->hn, |
185 | val->discard_time.abs_value_us); | 185 | val->discard_time.abs_value_us); |
@@ -289,7 +289,7 @@ struct GetContext | |||
289 | * | 289 | * |
290 | * @param cls the 'struct GetContext' | 290 | * @param cls the 'struct GetContext' |
291 | * @param key the key for the value(s) | 291 | * @param key the key for the value(s) |
292 | * @param value an existing value | 292 | * @param value an existing value |
293 | * @return GNUNET_YES to continue to iterate | 293 | * @return GNUNET_YES to continue to iterate |
294 | */ | 294 | */ |
295 | static int | 295 | static int |
@@ -341,7 +341,7 @@ heap_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
341 | 341 | ||
342 | get_ctx.type = type; | 342 | get_ctx.type = type; |
343 | get_ctx.iter = iter; | 343 | get_ctx.iter = iter; |
344 | get_ctx.iter_cls = iter_cls; | 344 | get_ctx.iter_cls = iter_cls; |
345 | get_ctx.cnt = 0; | 345 | get_ctx.cnt = 0; |
346 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map, | 346 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map, |
347 | key, | 347 | key, |
@@ -363,7 +363,7 @@ heap_plugin_del (void *cls) | |||
363 | { | 363 | { |
364 | struct Plugin *plugin = cls; | 364 | struct Plugin *plugin = cls; |
365 | struct Value *val; | 365 | struct Value *val; |
366 | 366 | ||
367 | val = GNUNET_CONTAINER_heap_remove_root (plugin->heap); | 367 | val = GNUNET_CONTAINER_heap_remove_root (plugin->heap); |
368 | if (NULL == val) | 368 | if (NULL == val) |
369 | return GNUNET_SYSERR; | 369 | return GNUNET_SYSERR; |
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index c8d66ead1..6d7e28021 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c | |||
@@ -78,14 +78,14 @@ init_connection (struct Plugin *plugin) | |||
78 | " value BYTEA NOT NULL DEFAULT ''," | 78 | " value BYTEA NOT NULL DEFAULT ''," |
79 | " path BYTEA DEFAULT '')" | 79 | " path BYTEA DEFAULT '')" |
80 | "WITH OIDS"); | 80 | "WITH OIDS"); |
81 | if ( (ret == NULL) || | 81 | if ( (ret == NULL) || |
82 | ((PQresultStatus (ret) != PGRES_COMMAND_OK) && | 82 | ((PQresultStatus (ret) != PGRES_COMMAND_OK) && |
83 | (0 != strcmp ("42P07", /* duplicate table */ | 83 | (0 != strcmp ("42P07", /* duplicate table */ |
84 | PQresultErrorField | 84 | PQresultErrorField |
85 | (ret, | 85 | (ret, |
86 | PG_DIAG_SQLSTATE))))) | 86 | PG_DIAG_SQLSTATE))))) |
87 | { | 87 | { |
88 | (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, | 88 | (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, |
89 | PGRES_COMMAND_OK, "CREATE TABLE", | 89 | PGRES_COMMAND_OK, "CREATE TABLE", |
90 | "gn090dc"); | 90 | "gn090dc"); |
91 | PQfinish (plugin->dbh); | 91 | PQfinish (plugin->dbh); |
@@ -198,7 +198,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
198 | PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths, | 198 | PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths, |
199 | paramFormats, 1); | 199 | paramFormats, 1); |
200 | if (GNUNET_OK != | 200 | if (GNUNET_OK != |
201 | GNUNET_POSTGRES_check_result (plugin->dbh, ret, | 201 | GNUNET_POSTGRES_check_result (plugin->dbh, ret, |
202 | PGRES_COMMAND_OK, "PQexecPrepared", "put")) | 202 | PGRES_COMMAND_OK, "PQexecPrepared", "put")) |
203 | return -1; | 203 | return -1; |
204 | PQclear (ret); | 204 | PQclear (ret); |
@@ -258,7 +258,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
258 | if (0 == (cnt = PQntuples (res))) | 258 | if (0 == (cnt = PQntuples (res))) |
259 | { | 259 | { |
260 | /* no result */ | 260 | /* no result */ |
261 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 261 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
262 | "Ending iteration (no more results)\n"); | 262 | "Ending iteration (no more results)\n"); |
263 | PQclear (res); | 263 | PQclear (res); |
264 | return 0; | 264 | return 0; |
@@ -289,7 +289,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
289 | } | 289 | } |
290 | path_len %= sizeof (struct GNUNET_PeerIdentity); | 290 | path_len %= sizeof (struct GNUNET_PeerIdentity); |
291 | path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3); | 291 | path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3); |
292 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 292 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
293 | "Found result of size %u bytes and type %u in database\n", | 293 | "Found result of size %u bytes and type %u in database\n", |
294 | (unsigned int) size, (unsigned int) type); | 294 | (unsigned int) size, (unsigned int) type); |
295 | if (GNUNET_SYSERR == | 295 | if (GNUNET_SYSERR == |
@@ -299,7 +299,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
299 | path_len, | 299 | path_len, |
300 | path)) | 300 | path)) |
301 | { | 301 | { |
302 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 302 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
303 | "Ending iteration (client error)\n"); | 303 | "Ending iteration (client error)\n"); |
304 | PQclear (res); | 304 | PQclear (res); |
305 | return cnt; | 305 | return cnt; |
@@ -330,14 +330,14 @@ postgres_plugin_del (void *cls) | |||
330 | if (GNUNET_OK != | 330 | if (GNUNET_OK != |
331 | GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm")) | 331 | GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm")) |
332 | { | 332 | { |
333 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 333 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
334 | "Ending iteration (postgres error)\n"); | 334 | "Ending iteration (postgres error)\n"); |
335 | return 0; | 335 | return 0; |
336 | } | 336 | } |
337 | if (0 == PQntuples (res)) | 337 | if (0 == PQntuples (res)) |
338 | { | 338 | { |
339 | /* no result */ | 339 | /* no result */ |
340 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 340 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
341 | "Ending iteration (no more results)\n"); | 341 | "Ending iteration (no more results)\n"); |
342 | PQclear (res); | 342 | PQclear (res); |
343 | return GNUNET_SYSERR; | 343 | return GNUNET_SYSERR; |
@@ -388,7 +388,7 @@ libgnunet_plugin_datacache_postgres_init (void *cls) | |||
388 | api->get = &postgres_plugin_get; | 388 | api->get = &postgres_plugin_get; |
389 | api->put = &postgres_plugin_put; | 389 | api->put = &postgres_plugin_put; |
390 | api->del = &postgres_plugin_del; | 390 | api->del = &postgres_plugin_del; |
391 | LOG (GNUNET_ERROR_TYPE_INFO, | 391 | LOG (GNUNET_ERROR_TYPE_INFO, |
392 | _("Postgres datacache running\n")); | 392 | _("Postgres datacache running\n")); |
393 | return api; | 393 | return api; |
394 | } | 394 | } |
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index 34aa61363..1901bdedd 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c | |||
@@ -96,13 +96,13 @@ sq_prepare (sqlite3 * dbh, const char *zSql, /* SQL statement, UTF-8 encoded | |||
96 | * @param type type of the value | 96 | * @param type type of the value |
97 | * @param discard_time when to discard the value in any case | 97 | * @param discard_time when to discard the value in any case |
98 | * @param path_info_len number of entries in 'path_info' | 98 | * @param path_info_len number of entries in 'path_info' |
99 | * @param path_info array of peers that have processed the request | 99 | * @param path_info array of peers that have processed the request |
100 | * @return 0 if duplicate, -1 on error, number of bytes used otherwise | 100 | * @return 0 if duplicate, -1 on error, number of bytes used otherwise |
101 | */ | 101 | */ |
102 | static ssize_t | 102 | static ssize_t |
103 | sqlite_plugin_put (void *cls, | 103 | sqlite_plugin_put (void *cls, |
104 | const struct GNUNET_HashCode *key, | 104 | const struct GNUNET_HashCode *key, |
105 | size_t size, const char *data, | 105 | size_t size, const char *data, |
106 | enum GNUNET_BLOCK_Type type, | 106 | enum GNUNET_BLOCK_Type type, |
107 | struct GNUNET_TIME_Absolute discard_time, | 107 | struct GNUNET_TIME_Absolute discard_time, |
108 | unsigned int path_info_len, | 108 | unsigned int path_info_len, |
@@ -135,11 +135,11 @@ sqlite_plugin_put (void *cls, | |||
135 | key, sizeof (struct GNUNET_HashCode), | 135 | key, sizeof (struct GNUNET_HashCode), |
136 | SQLITE_TRANSIENT)) || | 136 | SQLITE_TRANSIENT)) || |
137 | (SQLITE_OK != sqlite3_bind_blob (stmt, 4, | 137 | (SQLITE_OK != sqlite3_bind_blob (stmt, 4, |
138 | data, size, | 138 | data, size, |
139 | SQLITE_TRANSIENT)) || | 139 | SQLITE_TRANSIENT)) || |
140 | (SQLITE_OK != sqlite3_bind_blob (stmt, 5, | 140 | (SQLITE_OK != sqlite3_bind_blob (stmt, 5, |
141 | path_info, | 141 | path_info, |
142 | path_info_len * sizeof (struct GNUNET_PeerIdentity), | 142 | path_info_len * sizeof (struct GNUNET_PeerIdentity), |
143 | SQLITE_TRANSIENT))) | 143 | SQLITE_TRANSIENT))) |
144 | { | 144 | { |
145 | LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 145 | LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index 071ae721f..d0b7e5457 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c | |||
@@ -38,8 +38,8 @@ static const char *plugin_name; | |||
38 | 38 | ||
39 | 39 | ||
40 | static int | 40 | static int |
41 | checkIt (void *cls, | 41 | checkIt (void *cls, |
42 | const struct GNUNET_HashCode *key, | 42 | const struct GNUNET_HashCode *key, |
43 | size_t size, const char *data, | 43 | size_t size, const char *data, |
44 | enum GNUNET_BLOCK_Type type, | 44 | enum GNUNET_BLOCK_Type type, |
45 | struct GNUNET_TIME_Absolute exp, | 45 | struct GNUNET_TIME_Absolute exp, |
@@ -75,7 +75,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
75 | if (h == NULL) | 75 | if (h == NULL) |
76 | { | 76 | { |
77 | FPRINTF (stderr, | 77 | FPRINTF (stderr, |
78 | "%s", | 78 | "%s", |
79 | "Failed to initialize datacache. Database likely not setup, skipping test.\n"); | 79 | "Failed to initialize datacache. Database likely not setup, skipping test.\n"); |
80 | return; | 80 | return; |
81 | } | 81 | } |
@@ -87,7 +87,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
87 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); | 87 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); |
88 | ASSERT (GNUNET_OK == | 88 | ASSERT (GNUNET_OK == |
89 | GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode), | 89 | GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode), |
90 | (const char *) &n, 1 + i % 16, exp, | 90 | (const char *) &n, 1 + i % 16, exp, |
91 | 0, NULL)); | 91 | 0, NULL)); |
92 | k = n; | 92 | k = n; |
93 | } | 93 | } |