gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] 01/02: dead code elimination


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] 01/02: dead code elimination
Date: Tue, 18 Jun 2019 13:20:46 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

commit 6066ffcb9b07f9e2709d0382afa3fc05c52e21c7
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Jun 18 11:25:38 2019 +0200

    dead code elimination
---
 src/exchange/taler-exchange-aggregator.c           | 10 +++----
 src/exchange/taler-exchange-httpd_keystate.c       | 28 -------------------
 src/exchange/taler-exchange-httpd_keystate.h       | 16 -----------
 src/exchange/taler-exchange-httpd_payback.c        | 18 ++++++------
 src/exchange/taler-exchange-httpd_refresh_reveal.c | 25 ++++++++++-------
 src/exchange/taler-exchange-httpd_responses.c      | 32 ++++------------------
 src/exchange/taler-exchange-httpd_responses.h      | 25 ++++-------------
 src/exchange/test_taler_exchange_aggregator.c      |  2 +-
 src/exchange/test_taler_exchange_wirewatch.c       |  2 +-
 9 files changed, 43 insertions(+), 115 deletions(-)

diff --git a/src/exchange/taler-exchange-aggregator.c 
b/src/exchange/taler-exchange-aggregator.c
index fda0ad50..9b1c7e3e 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -620,19 +620,19 @@ refund_by_coin_cb (void *cls,
                   const struct TALER_Amount *amount_with_fee,
                   const struct TALER_Amount *refund_fee)
 {
-  struct AggregationUnit *au = cls;
+  struct AggregationUnit *aux = cls;
 
   /* TODO: potential optimization: include these conditions
      in the SELECT! */
   if (0 != GNUNET_memcmp (merchant_pub,
-                          &au->merchant_pub))
+                          &aux->merchant_pub))
     return GNUNET_OK; /* different merchant */
   if (0 != GNUNET_memcmp (h_contract,
-                          au->h_contract))
+                          aux->h_contract))
     return GNUNET_OK; /* different contract */
   if (GNUNET_OK !=
-      TALER_amount_subtract (&au->total_amount,
-                            &au->total_amount,
+      TALER_amount_subtract (&aux->total_amount,
+                            &aux->total_amount,
                             amount_with_fee))
   {
     GNUNET_break (0);
diff --git a/src/exchange/taler-exchange-httpd_keystate.c 
b/src/exchange/taler-exchange-httpd_keystate.c
index 7d6bb08a..6134faf3 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -1846,34 +1846,6 @@ TEH_KS_acquire_ (struct GNUNET_TIME_Absolute now,
 
 
 /**
- * Look up the issue for a denom public key.
- *
- * @param key_state state to look in
- * @param denom_pub denomination public key
- * @param use purpose for which the key is being located
- * @return the denomination key issue,
- *         or NULL if denom_pub could not be found
- */
-struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
-TEH_KS_denomination_key_lookup (const struct TEH_KS_StateHandle *key_state,
-                                const struct TALER_DenominationPublicKey 
*denom_pub,
-                               enum TEH_KS_DenominationKeyUse use)
-{
-  struct GNUNET_HashCode hc;
-
-  GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
-                                     &hc);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Looking for denom: '%s..'\n",
-              TALER_B2S (&hc));
-
-  return TEH_KS_denomination_key_lookup_by_hash (key_state,
-                                                 &hc,
-                                                 use);
-}
-
-
-/**
  * Look up the issue for a denom public key.  Note that the result
  * is only valid while the @a key_state is not released!
  *
diff --git a/src/exchange/taler-exchange-httpd_keystate.h 
b/src/exchange/taler-exchange-httpd_keystate.h
index c9b98230..e197e7ac 100644
--- a/src/exchange/taler-exchange-httpd_keystate.h
+++ b/src/exchange/taler-exchange-httpd_keystate.h
@@ -119,22 +119,6 @@ enum TEH_KS_DenominationKeyUse {
  * is only valid while the @a key_state is not released!
  *
  * @param key_state state to look in
- * @param denom_pub denomination public key
- * @param use purpose for which the key is being located
- * @return the denomination key issue,
- *         or NULL if denom_pub could not be found (or is not valid at this 
time for the given @a use)
- */
-struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
-TEH_KS_denomination_key_lookup (const struct TEH_KS_StateHandle *key_state,
-                                const struct TALER_DenominationPublicKey 
*denom_pub,
-                                enum TEH_KS_DenominationKeyUse use);
-
-
-/**
- * Look up the issue for a denom public key.  Note that the result
- * is only valid while the @a key_state is not released!
- *
- * @param key_state state to look in
  * @param denom_pub_hash hash of denomination public key
  * @param use purpose for which the key is being located
  * @return the denomination key issue,
diff --git a/src/exchange/taler-exchange-httpd_payback.c 
b/src/exchange/taler-exchange-httpd_payback.c
index 06181519..643b9fba 100644
--- a/src/exchange/taler-exchange-httpd_payback.c
+++ b/src/exchange/taler-exchange-httpd_payback.c
@@ -315,7 +315,6 @@ verify_and_execute_payback (struct MHD_Connection 
*connection,
   struct GNUNET_HashCode c_hash;
   char *coin_ev;
   size_t coin_ev_size;
-  int mhd_ret;
 
   /* check denomination exists and is in payback mode */
   key_state = TEH_KS_acquire (GNUNET_TIME_absolute_get ());
@@ -414,14 +413,17 @@ verify_and_execute_payback (struct MHD_Connection 
*connection,
   pc.coin_sig = coin_sig;
   pc.coin_bks = coin_bks;
   pc.coin = coin;
-  if (GNUNET_OK !=
-      TEH_DB_run_transaction (connection,
-                              "run payback",
-                             &mhd_ret,
-                             &payback_transaction,
-                             &pc))
-    return mhd_ret;
+  {
+    int mhd_ret;
 
+    if (GNUNET_OK !=
+        TEH_DB_run_transaction (connection,
+                                "run payback",
+                                &mhd_ret,
+                                &payback_transaction,
+                                &pc))
+      return mhd_ret;
+  }
   return reply_payback_success (connection,
                                &coin->coin_pub,
                                &pc.reserve_pub,
diff --git a/src/exchange/taler-exchange-httpd_refresh_reveal.c 
b/src/exchange/taler-exchange-httpd_refresh_reveal.c
index 0aee1982..6fc8d1c5 100644
--- a/src/exchange/taler-exchange-httpd_refresh_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refresh_reveal.c
@@ -57,8 +57,6 @@ reply_refresh_reveal_success (struct MHD_Connection 
*connection,
                              unsigned int num_newcoins,
                              const struct TALER_DenominationSignature *sigs)
 {
-  json_t *root;
-  json_t *obj;
   json_t *list;
   int ret;
 
@@ -67,6 +65,8 @@ reply_refresh_reveal_success (struct MHD_Connection 
*connection,
        newcoin_index < num_newcoins;
        newcoin_index++)
   {
+    json_t *obj;
+
     obj = json_object ();
     json_object_set_new (obj,
                         "ev_sig",
@@ -75,14 +75,19 @@ reply_refresh_reveal_success (struct MHD_Connection 
*connection,
                    json_array_append_new (list,
                                           obj));
   }
-  root = json_object ();
-  json_object_set_new (root,
-                       "ev_sigs",
-                       list);
-  ret = TEH_RESPONSE_reply_json (connection,
-                                 root,
-                                 MHD_HTTP_OK);
-  json_decref (root);
+
+  {
+    json_t *root;
+
+    root = json_object ();
+    json_object_set_new (root,
+                         "ev_sigs",
+                         list);
+    ret = TEH_RESPONSE_reply_json (connection,
+                                   root,
+                                   MHD_HTTP_OK);
+    json_decref (root);
+  }
   return ret;
 }
 
diff --git a/src/exchange/taler-exchange-httpd_responses.c 
b/src/exchange/taler-exchange-httpd_responses.c
index 234a0107..8b242096 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -319,41 +319,19 @@ TEH_RESPONSE_reply_signature_invalid (struct 
MHD_Connection *connection,
  */
 int
 TEH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
-                               enum TALER_ErrorCode ec,
+                                enum TALER_ErrorCode ec,
                                 const char *param_name)
 {
   return TEH_RESPONSE_reply_json_pack (connection,
                                        MHD_HTTP_BAD_REQUEST,
                                        "{s:s, s:I, s:s}",
                                        "error", "missing parameter",
-                                      "code", (json_int_t) ec,
+                                       "code", (json_int_t) ec,
                                        "parameter", param_name);
 }
 
 
 /**
- * Send a response indicating permission denied.
- *
- * @param connection the MHD connection to use
- * @param ec error code uniquely identifying the error
- * @param hint hint about why access was denied
- * @return a MHD result code
- */
-int
-TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
-                                     enum TALER_ErrorCode ec,
-                                      const char *hint)
-{
-  return TEH_RESPONSE_reply_json_pack (connection,
-                                       MHD_HTTP_FORBIDDEN,
-                                       "{s:s, s:I, s:s}",
-                                       "error", "permission denied",
-                                      "code", (json_int_t) ec,
-                                       "hint", hint);
-}
-
-
-/**
  * Send a response indicating an internal error.
  *
  * @param connection the MHD connection to use
@@ -363,14 +341,14 @@ TEH_RESPONSE_reply_permission_denied (struct 
MHD_Connection *connection,
  */
 int
 TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
-                                  enum TALER_ErrorCode ec,
+                                   enum TALER_ErrorCode ec,
                                    const char *hint)
 {
   return TEH_RESPONSE_reply_json_pack (connection,
                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
                                        "{s:s, s:I, s:s}",
                                        "error", "internal error",
-                                      "code", (json_int_t) ec,
+                                       "code", (json_int_t) ec,
                                        "hint", hint);
 }
 
@@ -385,7 +363,7 @@ TEH_RESPONSE_reply_internal_error (struct MHD_Connection 
*connection,
  */
 int
 TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
-                                  enum TALER_ErrorCode ec,
+                                   enum TALER_ErrorCode ec,
                                    const char *hint)
 {
   return TEH_RESPONSE_reply_json_pack (connection,
diff --git a/src/exchange/taler-exchange-httpd_responses.h 
b/src/exchange/taler-exchange-httpd_responses.h
index 1e504fd6..9b127156 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -152,25 +152,11 @@ TEH_RESPONSE_reply_arg_unknown (struct MHD_Connection 
*connection,
  */
 int
 TEH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
-                               enum TALER_ErrorCode ec,
+                                enum TALER_ErrorCode ec,
                                 const char *param_name);
 
 
 /**
- * Send a response indicating permission denied.
- *
- * @param connection the MHD connection to use
- * @param ec error code uniquely identifying the error
- * @param hint hint about why access was denied
- * @return a MHD result code
- */
-int
-TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
-                                     enum TALER_ErrorCode ec,
-                                      const char *hint);
-
-
-/**
  * Send a response indicating an internal error.
  *
  * @param connection the MHD connection to use
@@ -180,7 +166,7 @@ TEH_RESPONSE_reply_permission_denied (struct MHD_Connection 
*connection,
  */
 int
 TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
-                                  enum TALER_ErrorCode ec,
+                                   enum TALER_ErrorCode ec,
                                    const char *hint);
 
 
@@ -194,7 +180,7 @@ TEH_RESPONSE_reply_internal_error (struct MHD_Connection 
*connection,
  */
 int
 TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
-                                  enum TALER_ErrorCode ec,
+                                   enum TALER_ErrorCode ec,
                                    const char *hint);
 
 
@@ -208,7 +194,8 @@ TEH_RESPONSE_reply_external_error (struct MHD_Connection 
*connection,
  */
 int
 TEH_RESPONSE_reply_commit_error (struct MHD_Connection *connection,
-                                     enum TALER_ErrorCode ec);
+                                 enum TALER_ErrorCode ec);
+
 
 /**
  * Send a response indicating a failure to talk to the Exchange's
@@ -220,7 +207,7 @@ TEH_RESPONSE_reply_commit_error (struct MHD_Connection 
*connection,
  */
 int
 TEH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection,
-                                     enum TALER_ErrorCode ec);
+                                      enum TALER_ErrorCode ec);
 
 
 /**
diff --git a/src/exchange/test_taler_exchange_aggregator.c 
b/src/exchange/test_taler_exchange_aggregator.c
index c0d3d912..b02c976a 100644
--- a/src/exchange/test_taler_exchange_aggregator.c
+++ b/src/exchange/test_taler_exchange_aggregator.c
@@ -1277,7 +1277,7 @@ main (int argc,
   {
     fprintf (stderr,
              "Required port %u not available, skipping.\n",
-            8082);
+             (unsigned int) 8082);
     return 77;
   }
   cfg = GNUNET_CONFIGURATION_create ();
diff --git a/src/exchange/test_taler_exchange_wirewatch.c 
b/src/exchange/test_taler_exchange_wirewatch.c
index 8c1210da..4a23bdb5 100644
--- a/src/exchange/test_taler_exchange_wirewatch.c
+++ b/src/exchange/test_taler_exchange_wirewatch.c
@@ -815,7 +815,7 @@ main (int argc,
   {
     fprintf (stderr,
              "Required port %u not available, skipping.\n",
-            8082);
+             (unsigned int) 8082);
     return 77;
   }
   cfg = GNUNET_CONFIGURATION_create ();

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



reply via email to

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