aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib/bank_api_credit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-03 19:06:11 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-03 19:06:11 +0100
commit0d30e535851d99d0e679f1fddb77d2e54f4e387b (patch)
tree42d968114fd8d26f32639c7e92bf39170ae4551f /src/bank-lib/bank_api_credit.c
parenta9b3c564bdd80ad6d3db0d0c493144956c64368d (diff)
remove dead field, avoid unnecessary heap allocation
Diffstat (limited to 'src/bank-lib/bank_api_credit.c')
-rw-r--r--src/bank-lib/bank_api_credit.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c
index bb0d86631..551831d24 100644
--- a/src/bank-lib/bank_api_credit.c
+++ b/src/bank-lib/bank_api_credit.c
@@ -41,11 +41,6 @@ struct TALER_BANK_CreditHistoryHandle
char *request_url;
/**
- * The base URL of the bank.
- */
- char *bank_base_url;
-
- /**
* Handle for the request.
*/
struct GNUNET_CURL_Job *job;
@@ -144,8 +139,8 @@ handle_credit_history_finished (void *cls,
const void *response)
{
struct TALER_BANK_CreditHistoryHandle *hh = cls;
- enum TALER_ErrorCode ec;
const json_t *j = response;
+ enum TALER_ErrorCode ec;
hh->job = NULL;
switch (response_code)
@@ -236,7 +231,7 @@ TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
TALER_BANK_CreditHistoryCallback hres_cb,
void *hres_cb_cls)
{
- char *url;
+ char url[128];
struct TALER_BANK_CreditHistoryHandle *hh;
CURL *eh;
@@ -250,28 +245,28 @@ TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
(0 > num_results) ) ||
( (0 == start_row) &&
(0 < num_results) ) )
- GNUNET_asprintf (&url,
+ GNUNET_snprintf (url,
+ sizeof (url),
"history/incoming?delta=%lld",
(long long) num_results);
else
- GNUNET_asprintf (&url,
+ GNUNET_snprintf (url,
+ sizeof (url),
"history/incoming?delta=%lld&start=%llu",
(long long) num_results,
- start_row);
+ (unsigned long long) start_row);
hh = GNUNET_new (struct TALER_BANK_CreditHistoryHandle);
hh->hcb = hres_cb;
hh->hcb_cls = hres_cb_cls;
hh->request_url = TALER_url_join (auth->wire_gateway_url,
url,
NULL);
- GNUNET_free (url);
if (NULL == hh->request_url)
{
GNUNET_free (hh);
GNUNET_break (0);
return NULL;
}
- hh->bank_base_url = GNUNET_strdup (auth->wire_gateway_url);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requesting credit history at `%s'\n",
hh->request_url);
@@ -316,7 +311,6 @@ TALER_BANK_credit_history_cancel (struct TALER_BANK_CreditHistoryHandle *hh)
hh->job = NULL;
}
GNUNET_free (hh->request_url);
- GNUNET_free (hh->bank_base_url);
GNUNET_free (hh);
}