diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2018-10-15 18:42:21 +0900 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2018-10-15 18:42:21 +0900 |
commit | 4a5c38e78760886f5ad53259481487e03c61e372 (patch) | |
tree | 938c183afab8a41c56a66d10e737782b84aed5d9 /src/namestore | |
parent | 03fb70c9384b208cbeb57fb6c9b06145aa9c2e9e (diff) | |
download | gnunet-4a5c38e78760886f5ad53259481487e03c61e372.tar.gz gnunet-4a5c38e78760886f5ad53259481487e03c61e372.zip |
fix intendation
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 1a4e0138c..a47121082 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * This file is part of GNUnet | 2 | * This file is part of GNUnet |
3 | * Copyright (C) 2009-2017 GNUnet e.V. | 3 | * Copyright (C) 2009-2017 GNUnet e.V. |
4 | * | 4 | * |
5 | * GNUnet is free software: you can redistribute it and/or modify it | 5 | * GNUnet is free software: you can redistribute it and/or modify it |
6 | * under the terms of the GNU Affero General Public License as published | 6 | * under the terms of the GNU Affero General Public License as published |
7 | * by the Free Software Foundation, either version 3 of the License, | 7 | * by the Free Software Foundation, either version 3 of the License, |
8 | * or (at your option) any later version. | 8 | * or (at your option) any later version. |
9 | * | 9 | * |
10 | * GNUnet is distributed in the hope that it will be useful, but | 10 | * GNUnet is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Affero General Public License for more details. | 13 | * Affero General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU Affero General Public License | 15 | * You should have received a copy of the GNU Affero General Public License |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @file namestore/plugin_namestore_sqlite.c | 20 | * @file namestore/plugin_namestore_sqlite.c |
@@ -176,7 +176,7 @@ database_setup (struct Plugin *plugin) | |||
176 | &sqlite_filename)) | 176 | &sqlite_filename)) |
177 | { | 177 | { |
178 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 178 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
179 | "namestore-sqlite", | 179 | "namestore-sqlite", |
180 | "FILENAME"); | 180 | "FILENAME"); |
181 | return GNUNET_SYSERR; | 181 | return GNUNET_SYSERR; |
182 | } | 182 | } |
@@ -200,8 +200,8 @@ database_setup (struct Plugin *plugin) | |||
200 | &plugin->dbh)) | 200 | &plugin->dbh)) |
201 | { | 201 | { |
202 | LOG (GNUNET_ERROR_TYPE_ERROR, | 202 | LOG (GNUNET_ERROR_TYPE_ERROR, |
203 | _("Unable to initialize SQLite: %s.\n"), | 203 | _("Unable to initialize SQLite: %s.\n"), |
204 | sqlite3_errmsg (plugin->dbh)); | 204 | sqlite3_errmsg (plugin->dbh)); |
205 | return GNUNET_SYSERR; | 205 | return GNUNET_SYSERR; |
206 | } | 206 | } |
207 | GNUNET_break (SQLITE_OK == | 207 | GNUNET_break (SQLITE_OK == |
@@ -213,8 +213,8 @@ database_setup (struct Plugin *plugin) | |||
213 | { | 213 | { |
214 | GNUNET_break (0); | 214 | GNUNET_break (0); |
215 | LOG (GNUNET_ERROR_TYPE_ERROR, | 215 | LOG (GNUNET_ERROR_TYPE_ERROR, |
216 | _("Failed to setup database at `%s'\n"), | 216 | _("Failed to setup database at `%s'\n"), |
217 | plugin->fn); | 217 | plugin->fn); |
218 | return GNUNET_SYSERR; | 218 | return GNUNET_SYSERR; |
219 | } | 219 | } |
220 | 220 | ||
@@ -224,8 +224,8 @@ database_setup (struct Plugin *plugin) | |||
224 | { | 224 | { |
225 | GNUNET_break (0); | 225 | GNUNET_break (0); |
226 | LOG (GNUNET_ERROR_TYPE_ERROR, | 226 | LOG (GNUNET_ERROR_TYPE_ERROR, |
227 | _("Failed to setup database at `%s'\n"), | 227 | _("Failed to setup database at `%s'\n"), |
228 | plugin->fn); | 228 | plugin->fn); |
229 | return GNUNET_SYSERR; | 229 | return GNUNET_SYSERR; |
230 | } | 230 | } |
231 | return GNUNET_OK; | 231 | return GNUNET_OK; |
@@ -259,7 +259,7 @@ database_shutdown (struct Plugin *plugin) | |||
259 | if (result == SQLITE_BUSY) | 259 | if (result == SQLITE_BUSY) |
260 | { | 260 | { |
261 | LOG (GNUNET_ERROR_TYPE_WARNING, | 261 | LOG (GNUNET_ERROR_TYPE_WARNING, |
262 | _("Tried to close sqlite without finalizing all prepared statements.\n")); | 262 | _("Tried to close sqlite without finalizing all prepared statements.\n")); |
263 | stmt = sqlite3_next_stmt (plugin->dbh, | 263 | stmt = sqlite3_next_stmt (plugin->dbh, |
264 | NULL); | 264 | NULL); |
265 | while (NULL != stmt) | 265 | while (NULL != stmt) |
@@ -302,10 +302,10 @@ database_shutdown (struct Plugin *plugin) | |||
302 | */ | 302 | */ |
303 | static int | 303 | static int |
304 | namestore_sqlite_store_records (void *cls, | 304 | namestore_sqlite_store_records (void *cls, |
305 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 305 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
306 | const char *label, | 306 | const char *label, |
307 | unsigned int rd_count, | 307 | unsigned int rd_count, |
308 | const struct GNUNET_GNSRECORD_Data *rd) | 308 | const struct GNUNET_GNSRECORD_Data *rd) |
309 | { | 309 | { |
310 | struct Plugin *plugin = cls; | 310 | struct Plugin *plugin = cls; |
311 | int n; | 311 | int n; |
@@ -314,8 +314,8 @@ namestore_sqlite_store_records (void *cls, | |||
314 | ssize_t data_size; | 314 | ssize_t data_size; |
315 | 315 | ||
316 | memset (&pkey, | 316 | memset (&pkey, |
317 | 0, | 317 | 0, |
318 | sizeof (pkey)); | 318 | sizeof (pkey)); |
319 | for (unsigned int i=0;i<rd_count;i++) | 319 | for (unsigned int i=0;i<rd_count;i++) |
320 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) | 320 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) |
321 | { | 321 | { |
@@ -351,11 +351,11 @@ namestore_sqlite_store_records (void *cls, | |||
351 | ssize_t ret; | 351 | ssize_t ret; |
352 | 352 | ||
353 | ret = GNUNET_GNSRECORD_records_serialize (rd_count, | 353 | ret = GNUNET_GNSRECORD_records_serialize (rd_count, |
354 | rd, | 354 | rd, |
355 | data_size, | 355 | data_size, |
356 | data); | 356 | data); |
357 | if ( (ret < 0) || | 357 | if ( (ret < 0) || |
358 | (data_size != ret) ) | 358 | (data_size != ret) ) |
359 | { | 359 | { |
360 | GNUNET_break (0); | 360 | GNUNET_break (0); |
361 | return GNUNET_SYSERR; | 361 | return GNUNET_SYSERR; |
@@ -365,8 +365,8 @@ namestore_sqlite_store_records (void *cls, | |||
365 | dparams)) | 365 | dparams)) |
366 | { | 366 | { |
367 | LOG_SQLITE (plugin, | 367 | LOG_SQLITE (plugin, |
368 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 368 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
369 | "sqlite3_bind_XXXX"); | 369 | "sqlite3_bind_XXXX"); |
370 | GNUNET_SQ_reset (plugin->dbh, | 370 | GNUNET_SQ_reset (plugin->dbh, |
371 | plugin->delete_records); | 371 | plugin->delete_records); |
372 | return GNUNET_SYSERR; | 372 | return GNUNET_SYSERR; |
@@ -393,12 +393,12 @@ namestore_sqlite_store_records (void *cls, | |||
393 | GNUNET_SQ_bind (plugin->store_records, | 393 | GNUNET_SQ_bind (plugin->store_records, |
394 | sparams)) | 394 | sparams)) |
395 | { | 395 | { |
396 | LOG_SQLITE (plugin, | 396 | LOG_SQLITE (plugin, |
397 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 397 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
398 | "sqlite3_bind_XXXX"); | 398 | "sqlite3_bind_XXXX"); |
399 | GNUNET_SQ_reset (plugin->dbh, | 399 | GNUNET_SQ_reset (plugin->dbh, |
400 | plugin->store_records); | 400 | plugin->store_records); |
401 | return GNUNET_SYSERR; | 401 | return GNUNET_SYSERR; |
402 | } | 402 | } |
403 | n = sqlite3_step (plugin->store_records); | 403 | n = sqlite3_step (plugin->store_records); |
404 | GNUNET_SQ_reset (plugin->dbh, | 404 | GNUNET_SQ_reset (plugin->dbh, |
@@ -407,26 +407,26 @@ namestore_sqlite_store_records (void *cls, | |||
407 | } | 407 | } |
408 | switch (n) | 408 | switch (n) |
409 | { | 409 | { |
410 | case SQLITE_DONE: | 410 | case SQLITE_DONE: |
411 | if (0 != rd_count) | 411 | if (0 != rd_count) |
412 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 412 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
413 | "sqlite", | 413 | "sqlite", |
414 | "Record stored\n"); | 414 | "Record stored\n"); |
415 | else | 415 | else |
416 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 416 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
417 | "sqlite", | 417 | "sqlite", |
418 | "Record deleted\n"); | 418 | "Record deleted\n"); |
419 | return GNUNET_OK; | 419 | return GNUNET_OK; |
420 | case SQLITE_BUSY: | 420 | case SQLITE_BUSY: |
421 | LOG_SQLITE (plugin, | 421 | LOG_SQLITE (plugin, |
422 | GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | 422 | GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, |
423 | "sqlite3_step"); | 423 | "sqlite3_step"); |
424 | return GNUNET_NO; | 424 | return GNUNET_NO; |
425 | default: | 425 | default: |
426 | LOG_SQLITE (plugin, | 426 | LOG_SQLITE (plugin, |
427 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 427 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
428 | "sqlite3_step"); | 428 | "sqlite3_step"); |
429 | return GNUNET_SYSERR; | 429 | return GNUNET_SYSERR; |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
@@ -463,15 +463,15 @@ get_records_and_call_iterator (struct Plugin *plugin, | |||
463 | if (SQLITE_DONE == sret) | 463 | if (SQLITE_DONE == sret) |
464 | { | 464 | { |
465 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 465 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
466 | "Iteration done (no results)\n"); | 466 | "Iteration done (no results)\n"); |
467 | ret = GNUNET_NO; | 467 | ret = GNUNET_NO; |
468 | break; | 468 | break; |
469 | } | 469 | } |
470 | if (SQLITE_ROW != sret) | 470 | if (SQLITE_ROW != sret) |
471 | { | 471 | { |
472 | LOG_SQLITE (plugin, | 472 | LOG_SQLITE (plugin, |
473 | GNUNET_ERROR_TYPE_ERROR, | 473 | GNUNET_ERROR_TYPE_ERROR, |
474 | "sqlite_step"); | 474 | "sqlite_step"); |
475 | ret = GNUNET_SYSERR; | 475 | ret = GNUNET_SYSERR; |
476 | break; | 476 | break; |
477 | } | 477 | } |
@@ -487,7 +487,7 @@ get_records_and_call_iterator (struct Plugin *plugin, | |||
487 | GNUNET_SQ_result_spec_uint64 (&seq), | 487 | GNUNET_SQ_result_spec_uint64 (&seq), |
488 | GNUNET_SQ_result_spec_uint32 (&record_count), | 488 | GNUNET_SQ_result_spec_uint32 (&record_count), |
489 | GNUNET_SQ_result_spec_variable_size (&data, | 489 | GNUNET_SQ_result_spec_variable_size (&data, |
490 | &data_size), | 490 | &data_size), |
491 | GNUNET_SQ_result_spec_string (&label), | 491 | GNUNET_SQ_result_spec_string (&label), |
492 | GNUNET_SQ_result_spec_end | 492 | GNUNET_SQ_result_spec_end |
493 | }; | 493 | }; |
@@ -495,7 +495,7 @@ get_records_and_call_iterator (struct Plugin *plugin, | |||
495 | GNUNET_SQ_result_spec_uint64 (&seq), | 495 | GNUNET_SQ_result_spec_uint64 (&seq), |
496 | GNUNET_SQ_result_spec_uint32 (&record_count), | 496 | GNUNET_SQ_result_spec_uint32 (&record_count), |
497 | GNUNET_SQ_result_spec_variable_size (&data, | 497 | GNUNET_SQ_result_spec_variable_size (&data, |
498 | &data_size), | 498 | &data_size), |
499 | GNUNET_SQ_result_spec_string (&label), | 499 | GNUNET_SQ_result_spec_string (&label), |
500 | GNUNET_SQ_result_spec_auto_from_type (&zk), | 500 | GNUNET_SQ_result_spec_auto_from_type (&zk), |
501 | GNUNET_SQ_result_spec_end | 501 | GNUNET_SQ_result_spec_end |
@@ -540,7 +540,7 @@ get_records_and_call_iterator (struct Plugin *plugin, | |||
540 | zk = *zone_key; | 540 | zk = *zone_key; |
541 | if (NULL != iter) | 541 | if (NULL != iter) |
542 | iter (iter_cls, | 542 | iter (iter_cls, |
543 | seq, | 543 | seq, |
544 | &zk, | 544 | &zk, |
545 | label, | 545 | label, |
546 | record_count, | 546 | record_count, |
@@ -618,10 +618,10 @@ namestore_sqlite_lookup_records (void *cls, | |||
618 | */ | 618 | */ |
619 | static int | 619 | static int |
620 | namestore_sqlite_iterate_records (void *cls, | 620 | namestore_sqlite_iterate_records (void *cls, |
621 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 621 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
622 | uint64_t serial, | 622 | uint64_t serial, |
623 | uint64_t limit, | 623 | uint64_t limit, |
624 | GNUNET_NAMESTORE_RecordIterator iter, | 624 | GNUNET_NAMESTORE_RecordIterator iter, |
625 | void *iter_cls) | 625 | void *iter_cls) |
626 | { | 626 | { |
627 | struct Plugin *plugin = cls; | 627 | struct Plugin *plugin = cls; |
@@ -658,7 +658,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
658 | { | 658 | { |
659 | LOG_SQLITE (plugin, | 659 | LOG_SQLITE (plugin, |
660 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 660 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
661 | "sqlite3_bind_XXXX"); | 661 | "sqlite3_bind_XXXX"); |
662 | GNUNET_SQ_reset (plugin->dbh, | 662 | GNUNET_SQ_reset (plugin->dbh, |
663 | stmt); | 663 | stmt); |
664 | return GNUNET_SYSERR; | 664 | return GNUNET_SYSERR; |
@@ -685,10 +685,10 @@ namestore_sqlite_iterate_records (void *cls, | |||
685 | */ | 685 | */ |
686 | static int | 686 | static int |
687 | namestore_sqlite_zone_to_name (void *cls, | 687 | namestore_sqlite_zone_to_name (void *cls, |
688 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 688 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
689 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 689 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, |
690 | GNUNET_NAMESTORE_RecordIterator iter, | 690 | GNUNET_NAMESTORE_RecordIterator iter, |
691 | void *iter_cls) | 691 | void *iter_cls) |
692 | { | 692 | { |
693 | struct Plugin *plugin = cls; | 693 | struct Plugin *plugin = cls; |
694 | struct GNUNET_SQ_QueryParam params[] = { | 694 | struct GNUNET_SQ_QueryParam params[] = { |
@@ -703,7 +703,7 @@ namestore_sqlite_zone_to_name (void *cls, | |||
703 | { | 703 | { |
704 | LOG_SQLITE (plugin, | 704 | LOG_SQLITE (plugin, |
705 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 705 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
706 | "sqlite3_bind_XXXX"); | 706 | "sqlite3_bind_XXXX"); |
707 | GNUNET_SQ_reset (plugin->dbh, | 707 | GNUNET_SQ_reset (plugin->dbh, |
708 | plugin->zone_to_name); | 708 | plugin->zone_to_name); |
709 | return GNUNET_SYSERR; | 709 | return GNUNET_SYSERR; |