From eb559970846f0fa27f1f25c482cd07210a56f4b1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 25 Aug 2019 16:18:24 +0200 Subject: re-format code --- src/lib/exchange_api_reserve.c | 160 ++++++++++++++++++++++++----------------- 1 file changed, 96 insertions(+), 64 deletions(-) (limited to 'src/lib/exchange_api_reserve.c') diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c index 3a77f606a..f90bdbb8c 100644 --- a/src/lib/exchange_api_reserve.c +++ b/src/lib/exchange_api_reserve.c @@ -111,7 +111,7 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange, TALER_amount_get_zero (currency, &total_out)); uuid_off = 0; - for (off=0;offcb (rsh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), j, NULL, 0, NULL); @@ -597,7 +611,8 @@ handle_reserve_status_finished (void *cls, */ struct TALER_EXCHANGE_ReserveStatusHandle * TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_ReservePublicKeyP *reserve_pub, + const struct + TALER_ReservePublicKeyP *reserve_pub, TALER_EXCHANGE_ReserveStatusResultCallback cb, void *cb_cls) { @@ -614,7 +629,8 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, return NULL; } pub_str = GNUNET_STRINGS_data_to_string_alloc (reserve_pub, - sizeof (struct TALER_ReservePublicKeyP)); + sizeof (struct + TALER_ReservePublicKeyP)); GNUNET_asprintf (&arg_str, "/reserve/status?reserve_pub=%s", pub_str); @@ -625,16 +641,16 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, rsh->cb_cls = cb_cls; rsh->reserve_pub = *reserve_pub; rsh->url = TEAH_path_to_url (exchange, - arg_str); + arg_str); GNUNET_free (arg_str); eh = TEL_curl_easy_get (rsh->url); ctx = TEAH_handle_to_context (exchange); rsh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_NO, - &handle_reserve_status_finished, - rsh); + eh, + GNUNET_NO, + &handle_reserve_status_finished, + rsh); return rsh; } @@ -646,7 +662,8 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, * @param rsh the reserve status request handle */ void -TALER_EXCHANGE_reserve_status_cancel (struct TALER_EXCHANGE_ReserveStatusHandle *rsh) +TALER_EXCHANGE_reserve_status_cancel (struct + TALER_EXCHANGE_ReserveStatusHandle *rsh) { if (NULL != rsh->job) { @@ -743,7 +760,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -793,7 +810,8 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh, * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors */ static int -reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh, +reserve_withdraw_payment_required (struct + TALER_EXCHANGE_ReserveWithdrawHandle *wsh, const json_t *json) { struct TALER_Amount balance; @@ -803,7 +821,7 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle * size_t len; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount ("balance", &balance), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -832,7 +850,9 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle * not fit on the stack. Use "GNUNET_malloc_large" as a malicious exchange may theoretically try to crash us by giving a history that does not fit into our memory. */ - rhistory = GNUNET_malloc_large (sizeof (struct TALER_EXCHANGE_ReserveHistory) * len); + rhistory = GNUNET_malloc_large (sizeof (struct + TALER_EXCHANGE_ReserveHistory) + * len); if (NULL == rhistory) { GNUNET_break (0); @@ -962,7 +982,7 @@ handle_reserve_withdraw_finished (void *cls, { wsh->cb (wsh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), NULL, j); wsh->cb = NULL; @@ -1009,18 +1029,22 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, wsh->cb = res_cb; wsh->cb_cls = res_cb_cls; wsh->pk = *pk; - wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key); + wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup ( + pk->key.rsa_public_key); wsh->reserve_pub = *reserve_pub; wsh->c_hash = pd->c_hash; GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, &h_denom_pub); withdraw_obj = json_pack ("{s:o, s:o," /* denom_pub_hash and coin_ev */ " s:o, s:o}",/* reserve_pub and reserve_sig */ - "denom_pub_hash", GNUNET_JSON_from_data_auto (&h_denom_pub), + "denom_pub_hash", GNUNET_JSON_from_data_auto ( + &h_denom_pub), "coin_ev", GNUNET_JSON_from_data (pd->coin_ev, pd->coin_ev_size), - "reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub), - "reserve_sig", GNUNET_JSON_from_data_auto (reserve_sig)); + "reserve_pub", GNUNET_JSON_from_data_auto ( + reserve_pub), + "reserve_sig", GNUNET_JSON_from_data_auto ( + reserve_sig)); if (NULL == withdraw_obj) { GNUNET_break (0); @@ -1034,8 +1058,8 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, eh = TEL_curl_easy_get (wsh->url); if (GNUNET_OK != TALER_curl_easy_post (&wsh->ctx, - eh, - withdraw_obj)) + eh, + withdraw_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -1077,9 +1101,11 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_ReserveWithdrawHandle * TALER_EXCHANGE_reserve_withdraw (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_EXCHANGE_DenomPublicKey *pk, - const struct TALER_ReservePrivateKeyP *reserve_priv, + const struct + TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_PlanchetSecretsP *ps, - TALER_EXCHANGE_ReserveWithdrawResultCallback res_cb, + TALER_EXCHANGE_ReserveWithdrawResultCallback + res_cb, void *res_cb_cls) { struct TALER_Amount amount_with_fee; @@ -1158,11 +1184,15 @@ TALER_EXCHANGE_reserve_withdraw (struct TALER_EXCHANGE_Handle *exchange, */ struct TALER_EXCHANGE_ReserveWithdrawHandle * TALER_EXCHANGE_reserve_withdraw2 (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_EXCHANGE_DenomPublicKey *pk, - const struct TALER_ReserveSignatureP *reserve_sig, - const struct TALER_ReservePublicKeyP *reserve_pub, + const struct + TALER_EXCHANGE_DenomPublicKey *pk, + const struct + TALER_ReserveSignatureP *reserve_sig, + const struct + TALER_ReservePublicKeyP *reserve_pub, const struct TALER_PlanchetSecretsP *ps, - TALER_EXCHANGE_ReserveWithdrawResultCallback res_cb, + TALER_EXCHANGE_ReserveWithdrawResultCallback + res_cb, void *res_cb_cls) { struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh; @@ -1196,7 +1226,9 @@ TALER_EXCHANGE_reserve_withdraw2 (struct TALER_EXCHANGE_Handle *exchange, * @param sign the withdraw sign request handle */ void -TALER_EXCHANGE_reserve_withdraw_cancel (struct TALER_EXCHANGE_ReserveWithdrawHandle *sign) +TALER_EXCHANGE_reserve_withdraw_cancel (struct + TALER_EXCHANGE_ReserveWithdrawHandle * + sign) { if (NULL != sign->job) { -- cgit v1.2.3