-fix compiler warnings

This commit is contained in:
Christian Grothoff 2022-11-14 05:08:11 +01:00
parent 231cdaf4f7
commit 9db572706d
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 40 additions and 109 deletions

View File

@ -26,6 +26,18 @@
#include "pg_helper.h"
/**
* Connect to the database if the connection does not exist yet.
*
* @param pg the plugin-specific state
* @param skip_prepare true if we should skip prepared statement setup
* @return #GNUNET_OK on success
*/
enum GNUNET_GenericReturnValue
TEH_PG_internal_setup (struct PostgresClosure *pg,
bool skip_prepare);
enum GNUNET_GenericReturnValue
TEH_PG_preflight (void *cls)
{
@ -38,9 +50,8 @@ TEH_PG_preflight (void *cls)
if (! pg->init)
{
if (GNUNET_OK !=
internal_setup (pg,
false))
TEH_PG_internal_setup (pg,
false))
return GNUNET_SYSERR;
}
if (NULL == pg->transaction_name)

View File

@ -23,11 +23,12 @@
#include "taler_dbevents.h"
#include "taler_pq_lib.h"
#include "pg_start_read_only.h"
#include "pg_preflight.h"
#include "pg_helper.h"
enum GNUNET_GenericReturnValue
TEH_PG_start_read_only (void *cls,
const char *name)
const char *name)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_ExecuteStatement es[] = {

View File

@ -77,10 +77,10 @@ TEh_PG_update_kyc_process_by_row (
GNUNET_PQ_query_param_end
};
postgres_event_notify (pg,
&rep.header,
NULL,
0);
GNUNET_PQ_event_notify (pg->conn,
&rep.header,
NULL,
0);
PREPARE (pg,
"alert_kyc_status_change",
"INSERT INTO kyc_alerts"
@ -99,5 +99,3 @@ TEh_PG_update_kyc_process_by_row (
}
return qs;
}

View File

@ -130,7 +130,6 @@
} while (0)
/**
* Create the necessary tables if they are not present
*
@ -158,7 +157,6 @@ postgres_create_tables (void *cls)
}
/**
* Setup foreign servers (shards) for already existing tables
*
@ -262,7 +260,7 @@ postgres_setup_foreign_servers (void *cls,
* @param[in,out] pg connection to initialize
* @return #GNUNET_OK on success
*/
static enum GNUNET_GenericReturnValue
enum GNUNET_GenericReturnValue
prepare_statements (struct PostgresClosure *pg)
{
enum GNUNET_GenericReturnValue ret;
@ -493,7 +491,6 @@ prepare_statements (struct PostgresClosure *pg)
") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);"),
/* Used in #postgres_reserves_update() when the reserve is updated */
GNUNET_PQ_make_prepare (
"reserve_update",
@ -1739,7 +1736,7 @@ prepare_statements (struct PostgresClosure *pg)
" WHERE denom_pub_hash=$2);"),
/* Used in #postgres_begin_shard() */
/* Used in #postgres_begin_shard() */
GNUNET_PQ_make_prepare (
"get_open_shard",
"SELECT"
@ -1814,9 +1811,6 @@ prepare_statements (struct PostgresClosure *pg)
"DO UPDATE SET manifest=$2"),
/* Used in #postgres_select_purse_by_merge_pub */
GNUNET_PQ_make_prepare (
"select_purse_by_merge_pub",
@ -1842,7 +1836,6 @@ prepare_statements (struct PostgresClosure *pg)
" ($1, $2, $3);"),
/* Used in #postgres_update_kyc_requirement_by_row() */
GNUNET_PQ_make_prepare (
"update_legitimization_process",
@ -1856,11 +1849,6 @@ prepare_statements (struct PostgresClosure *pg)
" AND provider_section=$2;"),
GNUNET_PQ_PREPARED_STATEMENT_END
};
@ -1880,9 +1868,9 @@ prepare_statements (struct PostgresClosure *pg)
* @param skip_prepare true if we should skip prepared statement setup
* @return #GNUNET_OK on success
*/
static enum GNUNET_GenericReturnValue
internal_setup (struct PostgresClosure *pg,
bool skip_prepare)
enum GNUNET_GenericReturnValue
TEH_PG_internal_setup (struct PostgresClosure *pg,
bool skip_prepare)
{
if (NULL == pg->conn)
{
@ -1936,8 +1924,6 @@ internal_setup (struct PostgresClosure *pg,
}
/**
* Register callback to be invoked on events of type @a es.
*
@ -2004,7 +1990,6 @@ postgres_event_notify (void *cls,
}
/**
* Fetch information about a denomination key.
*
@ -2835,12 +2820,12 @@ postgres_reserves_in_insert (void *cls,
(We are only run in a larger transaction for performance.) */
enum GNUNET_DB_QueryStatus cs;
cs = TEH_PG_commit(pg);
cs = TEH_PG_commit (pg);
if (cs < 0)
return cs;
if (GNUNET_OK !=
TEH_PG_start (pg,
"reserve-update-serializable"))
"reserve-update-serializable"))
{
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
@ -2920,7 +2905,7 @@ postgres_reserves_in_insert (void *cls,
if (cs < 0)
return cs;
if (GNUNET_OK !=
TEH_PG_start_read_committed (pg, "reserve-insert-continued"))
TEH_PG_start_read_committed (pg, "reserve-insert-continued"))
{
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
@ -3029,8 +3014,6 @@ postgres_do_batch_withdraw (
}
/**
* Compute the shard number of a given @a merchant_pub.
*
@ -5096,7 +5079,6 @@ postgres_lookup_transfer_by_deposit (
}
/**
* Obtain wire fee from database.
*
@ -7960,8 +7942,6 @@ postgres_insert_auditor (void *cls,
}
/**
* Check the last date an exchange wire account was modified.
*
@ -8434,8 +8414,6 @@ postgres_add_denomination_key (
}
/**
* Lookup signing key meta data.
*
@ -8537,8 +8515,6 @@ postgres_select_auditor_denom_sig (
}
/**
* Function called to grab a work shard on an operation @a op. Runs in its
* own transaction.
@ -8565,7 +8541,7 @@ postgres_begin_shard (void *cls,
{
if (GNUNET_OK !=
TEH_PG_start (pg,
"begin_shard"))
"begin_shard"))
{
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
@ -8803,7 +8779,6 @@ postgres_complete_shard (void *cls,
}
/**
* Function called to release a revolving shard
* back into the work pool. Clears the
@ -8895,8 +8870,6 @@ postgres_set_extension_manifest (void *cls,
}
/**
* Function called to store configuration data about a partner
* exchange that we are federated with.
@ -8939,13 +8912,6 @@ postgres_insert_partner (void *cls,
}
/**
* Function called to clean up one expired purse.
*
@ -9045,8 +9011,6 @@ postgres_select_purse_by_merge_pub (
}
/**
* Set the current @a balance in the purse
* identified by @a purse_pub. Used by the auditor
@ -9076,22 +9040,6 @@ postgres_set_purse_balance (
}
/**
* Initialize Postgres database subsystem.
*
@ -9190,8 +9138,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
return NULL;
}
if (GNUNET_OK !=
internal_setup (pg,
true))
TEH_PG_internal_setup (pg,
true))
{
GNUNET_free (pg->exchange_url);
GNUNET_free (pg->currency);
@ -9202,22 +9150,14 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin = GNUNET_new (struct TALER_EXCHANGEDB_Plugin);
plugin->cls = pg;
plugin->create_tables = &postgres_create_tables;
plugin->setup_foreign_servers = &postgres_setup_foreign_servers;
plugin->event_listen = &postgres_event_listen;
plugin->event_listen_cancel = &postgres_event_listen_cancel;
plugin->event_notify = &postgres_event_notify;
plugin->get_denomination_info = &postgres_get_denomination_info;
plugin->iterate_denomination_info = &postgres_iterate_denomination_info;
plugin->iterate_denominations = &postgres_iterate_denominations;
plugin->iterate_active_auditors = &postgres_iterate_active_auditors;
plugin->iterate_auditor_denominations =
&postgres_iterate_auditor_denominations;
@ -9229,7 +9169,6 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->do_batch_withdraw = &postgres_do_batch_withdraw;
plugin->get_policy_details = &postgres_get_policy_details;
plugin->persist_policy_details = &postgres_persist_policy_details;
plugin->do_deposit = &postgres_do_deposit;
plugin->add_policy_fulfillment_proof = &postgres_add_policy_fulfillment_proof;
plugin->do_melt = &postgres_do_melt;
@ -9338,11 +9277,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &postgres_insert_auditor_denom_sig;
plugin->select_auditor_denom_sig
= &postgres_select_auditor_denom_sig;
plugin->add_denomination_key
= &postgres_add_denomination_key;
plugin->lookup_signing_key
= &postgres_lookup_signing_key;
plugin->begin_shard
@ -9351,35 +9287,21 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &postgres_abort_shard;
plugin->complete_shard
= &postgres_complete_shard;
plugin->release_revolving_shard
= &postgres_release_revolving_shard;
plugin->delete_shard_locks
= &postgres_delete_shard_locks;
plugin->set_extension_manifest
= &postgres_set_extension_manifest;
plugin->insert_partner
= &postgres_insert_partner;
plugin->expire_purse
= &postgres_expire_purse;
plugin->select_purse_by_merge_pub
= &postgres_select_purse_by_merge_pub;
plugin->set_purse_balance
= &postgres_set_purse_balance;
/* NEW style, sort alphabetically! */
plugin->do_reserve_open
= &TEH_PG_do_reserve_open;
@ -9529,7 +9451,6 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &TEH_PG_rollback;
return plugin;
}