From 8ce6d32f63a81e6ea61971859152e4a5ec3b7c40 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 20 Jan 2020 01:23:02 +0100 Subject: beautification --- src/exchangedb/exchangedb_accounts.c | 37 +++++++++++++++++++----------------- src/json/json_helper.c | 2 +- src/json/json_wire.c | 7 ++++--- src/mhd/mhd_config.c | 22 +++++++++++++-------- 4 files changed, 39 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/exchangedb/exchangedb_accounts.c b/src/exchangedb/exchangedb_accounts.c index aa923c5d3..0081c3283 100644 --- a/src/exchangedb/exchangedb_accounts.c +++ b/src/exchangedb/exchangedb_accounts.c @@ -61,7 +61,6 @@ check_for_account (void *cls, char *method; char *payto_uri; char *wire_response_filename; - struct TALER_EXCHANGEDB_AccountInfo ai; if (0 != strncasecmp (section, "exchange-account-", @@ -93,21 +92,26 @@ check_for_account (void *cls, "WIRE_RESPONSE", &wire_response_filename)) wire_response_filename = NULL; - ai.section_name = section; - ai.method = method; - ai.payto_uri = payto_uri; - ai.wire_response_filename = wire_response_filename; - - ai.debit_enabled = (GNUNET_YES == - GNUNET_CONFIGURATION_get_value_yesno (ctx->cfg, - section, - "ENABLE_DEBIT")); - ai.credit_enabled = (GNUNET_YES == - GNUNET_CONFIGURATION_get_value_yesno (ctx->cfg, - section, - "ENABLE_CREDIT")); - ctx->cb (ctx->cb_cls, - &ai); + { + struct TALER_EXCHANGEDB_AccountInfo ai = { + .section_name = section, + .method = method, + .payto_uri = payto_uri, + .wire_response_filename = wire_response_filename, + .debit_enabled = (GNUNET_YES == + GNUNET_CONFIGURATION_get_value_yesno ( + ctx->cfg, + section, + "ENABLE_DEBIT")), + .credit_enabled = (GNUNET_YES == + GNUNET_CONFIGURATION_get_value_yesno (ctx->cfg, + section, + "ENABLE_CREDIT")) + }; + + ctx->cb (ctx->cb_cls, + &ai); + } GNUNET_free (payto_uri); GNUNET_free (method); GNUNET_free_non_null (wire_response_filename); @@ -121,7 +125,6 @@ check_for_account (void *cls, * @param cb callback to invoke * @param cb_cls closure for @a cb */ -// FIXME(dold): why is this part of the exchange database? Does this really belong here? void TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg, TALER_EXCHANGEDB_AccountCallback cb, diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 70326b924..746b39e49 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -38,9 +38,9 @@ TALER_JSON_from_amount (const struct TALER_Amount *amount) char *amount_str = TALER_amount_to_string (amount); GNUNET_assert (NULL != amount_str); - { json_t *j = json_string (amount_str); + GNUNET_free (amount_str); return j; } diff --git a/src/json/json_wire.c b/src/json/json_wire.c index 8480b4e86..4fc4cfead 100644 --- a/src/json/json_wire.c +++ b/src/json/json_wire.c @@ -232,7 +232,6 @@ validate_iban (const char *iban) char *nbuf; unsigned long long dividend; unsigned long long remainder; - int nread; unsigned int i; unsigned int j; @@ -287,6 +286,8 @@ validate_iban (const char *iban) remainder = 0; for (unsigned int i = 0; isun_path) <= strlen (unix_path)) { @@ -281,9 +280,13 @@ TALER_MHD_open_unix_path (const char *unix_path, "set socket '%s' to mode %o\n", unix_path, unix_mode); - fd = GNUNET_NETWORK_get_fd (nh); - GNUNET_NETWORK_socket_free_memory_only_ (nh); - return fd; + { + int fd; + + fd = GNUNET_NETWORK_get_fd (nh); + GNUNET_NETWORK_socket_free_memory_only_ (nh); + return fd; + } } @@ -308,7 +311,6 @@ TALER_MHD_bind (const struct GNUNET_CONFIGURATION_Handle *cfg, char *bind_to; char *serve_unixpath; mode_t unixpath_mode; - int fh; char port_str[6]; struct addrinfo hints; struct addrinfo *res; @@ -390,7 +392,11 @@ TALER_MHD_bind (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_SCHEDULER_shutdown (); return -1; } - fh = GNUNET_NETWORK_get_fd (nh); - GNUNET_NETWORK_socket_free_memory_only_ (nh); - return fh; + { + int fh; + + fh = GNUNET_NETWORK_get_fd (nh); + GNUNET_NETWORK_socket_free_memory_only_ (nh); + return fh; + } } -- cgit v1.2.3