beautification

This commit is contained in:
Christian Grothoff 2020-01-20 01:23:02 +01:00
parent 500a7fe2bb
commit 8ce6d32f63
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 38 additions and 28 deletions

View File

@ -61,7 +61,6 @@ check_for_account (void *cls,
char *method; char *method;
char *payto_uri; char *payto_uri;
char *wire_response_filename; char *wire_response_filename;
struct TALER_EXCHANGEDB_AccountInfo ai;
if (0 != strncasecmp (section, if (0 != strncasecmp (section,
"exchange-account-", "exchange-account-",
@ -93,21 +92,26 @@ check_for_account (void *cls,
"WIRE_RESPONSE", "WIRE_RESPONSE",
&wire_response_filename)) &wire_response_filename))
wire_response_filename = NULL; wire_response_filename = NULL;
ai.section_name = section; {
ai.method = method; struct TALER_EXCHANGEDB_AccountInfo ai = {
ai.payto_uri = payto_uri; .section_name = section,
ai.wire_response_filename = wire_response_filename; .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"))
};
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, ctx->cb (ctx->cb_cls,
&ai); &ai);
}
GNUNET_free (payto_uri); GNUNET_free (payto_uri);
GNUNET_free (method); GNUNET_free (method);
GNUNET_free_non_null (wire_response_filename); GNUNET_free_non_null (wire_response_filename);
@ -121,7 +125,6 @@ check_for_account (void *cls,
* @param cb callback to invoke * @param cb callback to invoke
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
*/ */
// FIXME(dold): why is this part of the exchange database? Does this really belong here?
void void
TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg, TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg,
TALER_EXCHANGEDB_AccountCallback cb, TALER_EXCHANGEDB_AccountCallback cb,

View File

@ -38,9 +38,9 @@ TALER_JSON_from_amount (const struct TALER_Amount *amount)
char *amount_str = TALER_amount_to_string (amount); char *amount_str = TALER_amount_to_string (amount);
GNUNET_assert (NULL != amount_str); GNUNET_assert (NULL != amount_str);
{ {
json_t *j = json_string (amount_str); json_t *j = json_string (amount_str);
GNUNET_free (amount_str); GNUNET_free (amount_str);
return j; return j;
} }

View File

@ -232,7 +232,6 @@ validate_iban (const char *iban)
char *nbuf; char *nbuf;
unsigned long long dividend; unsigned long long dividend;
unsigned long long remainder; unsigned long long remainder;
int nread;
unsigned int i; unsigned int i;
unsigned int j; unsigned int j;
@ -287,6 +286,8 @@ validate_iban (const char *iban)
remainder = 0; remainder = 0;
for (unsigned int i = 0; i<j; i += 16) for (unsigned int i = 0; i<j; i += 16)
{ {
int nread;
if (1 != if (1 !=
sscanf (&nbuf[i], sscanf (&nbuf[i],
"%16llu %n", "%16llu %n",
@ -311,7 +312,7 @@ validate_iban (const char *iban)
/** /**
* Valudate payto://iban/ account URL (only account information, * Validate payto://iban/ account URL (only account information,
* wire subject and amount are ignored). * wire subject and amount are ignored).
* *
* @param account_url URL to parse * @param account_url URL to parse
@ -319,7 +320,7 @@ validate_iban (const char *iban)
* #GNUNET_NO if @a account_url is a payto URI of a different type, * #GNUNET_NO if @a account_url is a payto URI of a different type,
* #GNUNET_SYSERR if the IBAN (checksum) is incorrect * #GNUNET_SYSERR if the IBAN (checksum) is incorrect
*/ */
int static int
validate_payto_iban (const char *account_url) validate_payto_iban (const char *account_url)
{ {
const char *iban; const char *iban;

View File

@ -208,7 +208,6 @@ TALER_MHD_open_unix_path (const char *unix_path,
{ {
struct GNUNET_NETWORK_Handle *nh; struct GNUNET_NETWORK_Handle *nh;
struct sockaddr_un *un; struct sockaddr_un *un;
int fd;
if (sizeof (un->sun_path) <= strlen (unix_path)) if (sizeof (un->sun_path) <= strlen (unix_path))
{ {
@ -281,10 +280,14 @@ TALER_MHD_open_unix_path (const char *unix_path,
"set socket '%s' to mode %o\n", "set socket '%s' to mode %o\n",
unix_path, unix_path,
unix_mode); unix_mode);
{
int fd;
fd = GNUNET_NETWORK_get_fd (nh); fd = GNUNET_NETWORK_get_fd (nh);
GNUNET_NETWORK_socket_free_memory_only_ (nh); GNUNET_NETWORK_socket_free_memory_only_ (nh);
return fd; return fd;
} }
}
/** /**
@ -308,7 +311,6 @@ TALER_MHD_bind (const struct GNUNET_CONFIGURATION_Handle *cfg,
char *bind_to; char *bind_to;
char *serve_unixpath; char *serve_unixpath;
mode_t unixpath_mode; mode_t unixpath_mode;
int fh;
char port_str[6]; char port_str[6];
struct addrinfo hints; struct addrinfo hints;
struct addrinfo *res; struct addrinfo *res;
@ -390,7 +392,11 @@ TALER_MHD_bind (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return -1; return -1;
} }
{
int fh;
fh = GNUNET_NETWORK_get_fd (nh); fh = GNUNET_NETWORK_get_fd (nh);
GNUNET_NETWORK_socket_free_memory_only_ (nh); GNUNET_NETWORK_socket_free_memory_only_ (nh);
return fh; return fh;
} }
}