diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-08-27 00:19:01 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-08-27 00:19:01 +0200 |
commit | c2ccf110ea703eb475dc3ec71ef017ac1c6c5d18 (patch) | |
tree | 82e5c9703d1009fa6fda3a956d098df4915defe8 | |
parent | 4521504d17fd2e37c9159b98aba131bd4b5b693f (diff) |
-style fixes
-rw-r--r-- | src/auditordb/pg_get_bad_sig_losses.c | 42 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.h | 43 |
2 files changed, 54 insertions, 31 deletions
diff --git a/src/auditordb/pg_get_bad_sig_losses.c b/src/auditordb/pg_get_bad_sig_losses.c index 096739779..a40f01046 100644 --- a/src/auditordb/pg_get_bad_sig_losses.c +++ b/src/auditordb/pg_get_bad_sig_losses.c @@ -13,14 +13,11 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include "taler_error_codes.h" #include "taler_dbevents.h" #include "taler_pq_lib.h" #include "pg_helper.h" - #include "pg_get_bad_sig_losses.h" @@ -71,17 +68,16 @@ bad_sig_losses_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { uint64_t serial_id; - struct TALER_AUDITORDB_BadSigLosses dc; - struct GNUNET_PQ_ResultSpec rs[] = { - - GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_string ("operation", &dc.operation), - TALER_PQ_RESULT_SPEC_AMOUNT ("loss", &dc.loss), + GNUNET_PQ_result_spec_uint64 ("row_id", + &serial_id), + GNUNET_PQ_result_spec_string ("operation", + &dc.operation), + TALER_PQ_RESULT_SPEC_AMOUNT ("loss", + &dc.loss), GNUNET_PQ_result_spec_auto_from_type ("operation_specific_pub", &dc.operation_specific_pub), - GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; @@ -95,9 +91,7 @@ bad_sig_losses_cb (void *cls, dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - dcc->qs = i + 1; - rval = dcc->cb (dcc->cb_cls, serial_id, &dc); @@ -120,27 +114,13 @@ TAH_PG_get_bad_sig_losses ( TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls) { - + struct PostgresClosure *pg = cls; + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); /*if true, does not filter for an operation specific key*/ bool any_spec_pub = ! filter_spec_pub; - /*if true, does not filter for an operation*/ - bool any_op = true; - const char *o; - - if (op != NULL) - { - any_op = false; - o = op; - } - else - { - o = ""; - } - - uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); - - struct PostgresClosure *pg = cls; + bool any_op = (NULL == op) ? true : false; + const char *o = (NULL == op) ? "" : op; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), @@ -200,4 +180,4 @@ TAH_PG_get_bad_sig_losses ( return dcc.qs; GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); return qs; -}
\ No newline at end of file +} diff --git a/src/exchangedb/plugin_exchangedb_postgres.h b/src/exchangedb/plugin_exchangedb_postgres.h new file mode 100644 index 000000000..daceee7c7 --- /dev/null +++ b/src/exchangedb/plugin_exchangedb_postgres.h @@ -0,0 +1,43 @@ +/* + This file is part of TALER + Copyright (C) 2014--2023 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +/** + * @file plugin_exchangedb_postgres.h + * @brief Low-level (statement-level) Postgres database access for the exchange + * @author Florian Dold + * @author Christian Grothoff + * @author Sree Harsha Totakura + * @author Marcello Stanisci + * @author Özgür Kesim + */ +#ifndef PLUGIN_EXCHANGEDB_POSTGRES_H +#define PLUGIN_EXCHANGEDB_POSTGRES_H +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" + + +/** + * Connect to the database if the connection does not exist yet. + * + * @param pg the plugin-specific state + * @return #GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +TEH_PG_internal_setup (struct PostgresClosure *pg); + +#endif |