From 4322bbf2f1722b4c53114901768772dabdb7e822 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 15 Mar 2020 20:08:38 +0100 Subject: move common logic to parse currency into libtalerutil --- src/exchange/taler-exchange-httpd.c | 25 ------------------ src/exchange/taler-exchange-wirewatch.c | 47 +++++++++------------------------ 2 files changed, 12 insertions(+), 60 deletions(-) (limited to 'src/exchange') diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 98d6a9ba5..9524c2cbf 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -758,31 +758,6 @@ exchange_serve_process_config () "REVOCATION_DIR"); return GNUNET_SYSERR; } - { - char *currency_string; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "taler", - "CURRENCY", - ¤cy_string)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "taler", - "CURRENCY"); - return GNUNET_SYSERR; - } - if (strlen (currency_string) >= TALER_CURRENCY_LEN) - { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, - "taler", - "CURRENCY", - "Value is too long"); - GNUNET_free (currency_string); - return GNUNET_SYSERR; - } - GNUNET_free (currency_string); - } { char *master_public_key_str; diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index 69929e127..3731f6633 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -100,11 +100,6 @@ static struct GNUNET_CURL_Context *ctx; */ static struct GNUNET_CURL_RescheduleContext *rc; -/** - * Which currency is used by this exchange? - */ -static char *exchange_currency_string; - /** * The exchange's configuration (global) */ @@ -177,8 +172,6 @@ static struct TALER_BANK_CreditHistoryHandle *hh; static void shutdown_task (void *cls) { - struct WireAccount *wa; - (void) cls; if (NULL != hh) { @@ -202,14 +195,18 @@ shutdown_task (void *cls) } TALER_EXCHANGEDB_plugin_unload (db_plugin); db_plugin = NULL; - while (NULL != (wa = wa_head)) { - GNUNET_CONTAINER_DLL_remove (wa_head, - wa_tail, - wa); - TALER_BANK_auth_free (&wa->auth); - GNUNET_free (wa->section_name); - GNUNET_free (wa); + struct WireAccount *wa; + + while (NULL != (wa = wa_head)) + { + GNUNET_CONTAINER_DLL_remove (wa_head, + wa_tail, + wa); + TALER_BANK_auth_free (&wa->auth); + GNUNET_free (wa->section_name); + GNUNET_free (wa); + } } wa_pos = NULL; last_row_off = 0; @@ -259,28 +256,8 @@ add_account_cb (void *cls, * @return #GNUNET_OK on success */ static int -exchange_serve_process_config () +exchange_serve_process_config (void) { - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "taler", - "CURRENCY", - &exchange_currency_string)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "taler", - "CURRENCY"); - return GNUNET_SYSERR; - } - if (strlen (exchange_currency_string) >= TALER_CURRENCY_LEN) - { - fprintf (stderr, - "Currency `%s' longer than the allowed limit of %u characters.", - exchange_currency_string, - (unsigned int) TALER_CURRENCY_LEN); - return GNUNET_SYSERR; - } - if (NULL == (db_plugin = TALER_EXCHANGEDB_plugin_load (cfg))) { -- cgit v1.2.3