gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: remove duplicated, wrong ec logi


From: gnunet
Subject: [taler-exchange] branch master updated: remove duplicated, wrong ec logic in bank-lib
Date: Thu, 16 Jan 2020 21:02:21 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 3d9ad86d remove duplicated, wrong ec logic in bank-lib
3d9ad86d is described below

commit 3d9ad86dfb34121c88a4446b216c74c14517722f
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Jan 16 21:02:10 2020 +0100

    remove duplicated, wrong ec logic in bank-lib
---
 src/bank-lib/bank_api_admin.c    | 12 ++++++------
 src/bank-lib/bank_api_common.c   | 30 ------------------------------
 src/bank-lib/bank_api_common.h   | 10 ----------
 src/bank-lib/bank_api_credit.c   | 12 ++++++------
 src/bank-lib/bank_api_debit.c    | 12 ++++++------
 src/bank-lib/bank_api_transfer.c | 12 ++++++------
 6 files changed, 24 insertions(+), 64 deletions(-)

diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index 4c1cd320..d81c54dd 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -112,27 +112,27 @@ handle_admin_add_incoming_finished (void *cls,
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the bank is buggy
        (or API version conflict); just pass JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_FORBIDDEN:
     /* Access denied */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_UNAUTHORIZED:
     /* Nothing really to verify, bank says one of the signatures is
        invalid; as we checked them, this should never happen, we
        should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_NOT_FOUND:
     /* Nothing really to verify, this should never
        happen, we should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     /* Server had an internal issue; we should retry, but this API
        leaves this to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   default:
     /* unexpected response code */
@@ -140,7 +140,7 @@ handle_admin_add_incoming_finished (void *cls,
                 "Unexpected response code %u\n",
                 (unsigned int) response_code);
     GNUNET_break (0);
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     response_code = 0;
     break;
   }
diff --git a/src/bank-lib/bank_api_common.c b/src/bank-lib/bank_api_common.c
index d9df5b39..5e7ce687 100644
--- a/src/bank-lib/bank_api_common.c
+++ b/src/bank-lib/bank_api_common.c
@@ -97,34 +97,4 @@ TALER_BANK_path_to_url_ (const char *u,
 }
 
 
-/**
- * Parse error code given in @a json.
- *
- * @param json the json to parse.
- *
- * @return error code, or #TALER_EC_INVALID if not found.
- */
-enum TALER_ErrorCode
-TALER_BANK_parse_ec_ (const json_t *json)
-{
-  uint32_t ec;
-
-  struct GNUNET_JSON_Specification spec[] = {
-    GNUNET_JSON_spec_uint32 ("ec",
-                             &ec),
-    GNUNET_JSON_spec_end ()
-  };
-
-  if (GNUNET_OK !=
-      GNUNET_JSON_parse (json,
-                         spec,
-                         NULL, NULL))
-  {
-    GNUNET_break_op (0);
-    return TALER_EC_INVALID;
-  }
-  return (enum TALER_ErrorCode) ec;
-}
-
-
 /* end of bank_api_common.c */
diff --git a/src/bank-lib/bank_api_common.h b/src/bank-lib/bank_api_common.h
index 1120ed94..d2d022bd 100644
--- a/src/bank-lib/bank_api_common.h
+++ b/src/bank-lib/bank_api_common.h
@@ -63,14 +63,4 @@ TALER_BANK_path_to_url_ (const char *u,
                          const char *path);
 
 
-/**
- * Parse error code given in @a json.
- *
- * @param json the json to parse
- * @return error code, or #TALER_EC_INVALID if not found
- */
-enum TALER_ErrorCode
-TALER_BANK_parse_ec_ (const json_t *json);
-
-
 #endif
diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c
index 161da876..be4c1972 100644
--- a/src/bank-lib/bank_api_credit.c
+++ b/src/bank-lib/bank_api_credit.c
@@ -172,27 +172,27 @@ handle_history_finished (void *cls,
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the bank is buggy
        (or API version conflict); just pass JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_FORBIDDEN:
     /* Access denied */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_UNAUTHORIZED:
     /* Nothing really to verify, bank says one of the signatures is
        invalid; as we checked them, this should never happen, we
        should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_NOT_FOUND:
     /* Nothing really to verify, this should never
        happen, we should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     /* Server had an internal issue; we should retry, but this API
        leaves this to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   default:
     /* unexpected response code */
@@ -200,7 +200,7 @@ handle_history_finished (void *cls,
                 "Unexpected response code %u\n",
                 (unsigned int) response_code);
     GNUNET_break (0);
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     response_code = 0;
     break;
   }
diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c
index 5688d477..1afe0e45 100644
--- a/src/bank-lib/bank_api_debit.c
+++ b/src/bank-lib/bank_api_debit.c
@@ -169,27 +169,27 @@ handle_history_finished (void *cls,
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the bank is buggy
        (or API version conflict); just pass JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_FORBIDDEN:
     /* Access denied */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_UNAUTHORIZED:
     /* Nothing really to verify, bank says one of the signatures is
        invalid; as we checked them, this should never happen, we
        should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_NOT_FOUND:
     /* Nothing really to verify, this should never
        happen, we should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     /* Server had an internal issue; we should retry, but this API
        leaves this to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   default:
     /* unexpected response code */
@@ -197,7 +197,7 @@ handle_history_finished (void *cls,
                 "Unexpected response code %u\n",
                 (unsigned int) response_code);
     GNUNET_break (0);
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     response_code = 0;
     break;
   }
diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c
index 404e84b6..96ed0071 100644
--- a/src/bank-lib/bank_api_transfer.c
+++ b/src/bank-lib/bank_api_transfer.c
@@ -196,27 +196,27 @@ handle_transfer_finished (void *cls,
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the bank is buggy
        (or API version conflict); just pass JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_FORBIDDEN:
     /* Access denied */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_UNAUTHORIZED:
     /* Nothing really to verify, bank says one of the signatures is
        invalid; as we checked them, this should never happen, we
        should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_NOT_FOUND:
     /* Nothing really to verify, this should never
        happen, we should pass the JSON reply to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     /* Server had an internal issue; we should retry, but this API
        leaves this to the application */
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     break;
   default:
     /* unexpected response code */
@@ -224,7 +224,7 @@ handle_transfer_finished (void *cls,
                 "Unexpected response code %u\n",
                 (unsigned int) response_code);
     GNUNET_break (0);
-    ec = TALER_BANK_parse_ec_ (j);
+    ec = TALER_JSON_get_error_code (j);
     response_code = 0;
     break;
   }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]