From 19f4c50dabd6a4c29749a9c758e7e0da99d9e31f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 20 Oct 2016 21:19:01 +0200 Subject: rename and move TALER_EXCHANGE_json_get_error_code to TALER_JSON_get_error_code --- src/exchange-lib/exchange_api_admin.c | 2 +- src/exchange-lib/exchange_api_common.c | 27 ----------------------- src/exchange-lib/exchange_api_deposit.c | 2 +- src/exchange-lib/exchange_api_refresh.c | 6 ++--- src/exchange-lib/exchange_api_refresh_link.c | 2 +- src/exchange-lib/exchange_api_refund.c | 2 +- src/exchange-lib/exchange_api_reserve.c | 4 ++-- src/exchange-lib/exchange_api_track_transaction.c | 2 +- src/exchange-lib/exchange_api_track_transfer.c | 2 +- src/exchange-lib/exchange_api_wire.c | 2 +- 10 files changed, 12 insertions(+), 39 deletions(-) (limited to 'src/exchange-lib') diff --git a/src/exchange-lib/exchange_api_admin.c b/src/exchange-lib/exchange_api_admin.c index d50afdc6b..e6cb8101c 100644 --- a/src/exchange-lib/exchange_api_admin.c +++ b/src/exchange-lib/exchange_api_admin.c @@ -129,7 +129,7 @@ handle_admin_add_incoming_finished (void *cls, } aai->cb (aai->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), json); TALER_EXCHANGE_admin_add_incoming_cancel (aai); } diff --git a/src/exchange-lib/exchange_api_common.c b/src/exchange-lib/exchange_api_common.c index bd45619d8..a531b1c39 100644 --- a/src/exchange-lib/exchange_api_common.c +++ b/src/exchange-lib/exchange_api_common.c @@ -26,33 +26,6 @@ #include "taler_signatures.h" -/** - * Extract the Taler error code from the given @a json object. - * Note that #TALER_EC_NONE is returned if no "code" is present. - * - * @param json response to extract the error code from - * @return the "code" value from @a json - */ -enum TALER_ErrorCode -TALER_EXCHANGE_json_get_error_code (const json_t *json) -{ - const json_t *jc; - - if (NULL == json) - { - GNUNET_break_op (0); - return TALER_EC_INVALID_RESPONSE; - } - jc = json_object_get (json, "code"); - if (NULL == jc) - return TALER_EC_NONE; - if (json_is_integer (jc)) - return (enum TALER_ErrorCode) json_integer_value (jc); - GNUNET_break_op (0); - return TALER_EC_INVALID; -} - - /** * Verify a coins transaction history as returned by the exchange. * diff --git a/src/exchange-lib/exchange_api_deposit.c b/src/exchange-lib/exchange_api_deposit.c index 416f4419c..9282bbfd1 100644 --- a/src/exchange-lib/exchange_api_deposit.c +++ b/src/exchange-lib/exchange_api_deposit.c @@ -261,7 +261,7 @@ handle_deposit_finished (void *cls, } dh->cb (dh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), ep, json); TALER_EXCHANGE_deposit_cancel (dh); diff --git a/src/exchange-lib/exchange_api_refresh.c b/src/exchange-lib/exchange_api_refresh.c index 556a53c48..c3216a6e6 100644 --- a/src/exchange-lib/exchange_api_refresh.c +++ b/src/exchange-lib/exchange_api_refresh.c @@ -1114,7 +1114,7 @@ handle_refresh_melt_finished (void *cls, { rmh->melt_cb (rmh->melt_cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), noreveal_index, (0 == response_code) ? NULL : &exchange_pub, json); @@ -1160,7 +1160,7 @@ handle_refresh_melt_finished (void *cls, if (NULL != rmh->melt_cb) rmh->melt_cb (rmh->melt_cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), UINT16_MAX, NULL, json); @@ -1636,7 +1636,7 @@ handle_refresh_reveal_finished (void *cls, if (NULL != rrh->reveal_cb) rrh->reveal_cb (rrh->reveal_cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), 0, NULL, NULL, diff --git a/src/exchange-lib/exchange_api_refresh_link.c b/src/exchange-lib/exchange_api_refresh_link.c index 32f3f2ad5..9b825138e 100644 --- a/src/exchange-lib/exchange_api_refresh_link.c +++ b/src/exchange-lib/exchange_api_refresh_link.c @@ -346,7 +346,7 @@ handle_refresh_link_finished (void *cls, if (NULL != rlh->link_cb) rlh->link_cb (rlh->link_cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), 0, NULL, NULL, diff --git a/src/exchange-lib/exchange_api_refund.c b/src/exchange-lib/exchange_api_refund.c index 0d5656e1f..be080c57b 100644 --- a/src/exchange-lib/exchange_api_refund.c +++ b/src/exchange-lib/exchange_api_refund.c @@ -195,7 +195,7 @@ handle_refund_finished (void *cls, } rh->cb (rh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), ep, json); TALER_EXCHANGE_refund_cancel (rh); diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c index bbba4f2b0..28f329c42 100644 --- a/src/exchange-lib/exchange_api_reserve.c +++ b/src/exchange-lib/exchange_api_reserve.c @@ -389,7 +389,7 @@ handle_reserve_status_finished (void *cls, if (NULL != wsh->cb) wsh->cb (wsh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), json, NULL, 0, NULL); @@ -766,7 +766,7 @@ handle_reserve_withdraw_finished (void *cls, if (NULL != wsh->cb) wsh->cb (wsh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), NULL, json); TALER_EXCHANGE_reserve_withdraw_cancel (wsh); diff --git a/src/exchange-lib/exchange_api_track_transaction.c b/src/exchange-lib/exchange_api_track_transaction.c index 50e10c446..7fd2efb21 100644 --- a/src/exchange-lib/exchange_api_track_transaction.c +++ b/src/exchange-lib/exchange_api_track_transaction.c @@ -238,7 +238,7 @@ handle_deposit_wtid_finished (void *cls, } dwh->cb (dwh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), ep, json, wtid, diff --git a/src/exchange-lib/exchange_api_track_transfer.c b/src/exchange-lib/exchange_api_track_transfer.c index c4ad3fd20..8ed5865d7 100644 --- a/src/exchange-lib/exchange_api_track_transfer.c +++ b/src/exchange-lib/exchange_api_track_transfer.c @@ -253,7 +253,7 @@ handle_track_transfer_finished (void *cls, } wdh->cb (wdh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), NULL, json, NULL, diff --git a/src/exchange-lib/exchange_api_wire.c b/src/exchange-lib/exchange_api_wire.c index 71a717d4e..7401e66d4 100644 --- a/src/exchange-lib/exchange_api_wire.c +++ b/src/exchange-lib/exchange_api_wire.c @@ -209,7 +209,7 @@ handle_wire_finished (void *cls, } wh->cb (wh->cb_cls, response_code, - TALER_EXCHANGE_json_get_error_code (json), + TALER_JSON_get_error_code (json), (NULL != keep) ? keep : json); if (NULL != keep) json_decref (keep); -- cgit v1.2.3