gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (274ec61 -> 0e6c4ba)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (274ec61 -> 0e6c4ba)
Date: Thu, 15 Jun 2017 23:16:19 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from 274ec61  error code for merchant's /refund
     new b874a4c  remove dead or unnecessary macros
     new eb35468  fix compiler warning due to possibly unknown switch enum 
values being handled poorly
     new 0e6c4ba  work on #5010

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/auditordb/plugin_auditordb_postgres.c          | 25 ++------
 src/auditordb/test_auditordb.c                     |  3 +-
 src/bank-lib/bank_api_common.c                     |  5 +-
 src/exchange/taler-exchange-httpd_keystate.c       | 10 +--
 src/exchange/test_taler_exchange_aggregator.c      |  2 +-
 src/exchangedb/perf_taler_exchangedb_interpreter.c |  6 +-
 src/exchangedb/plugin_exchangedb_postgres.c        | 73 ++++------------------
 src/exchangedb/test_exchangedb.c                   |  2 +-
 src/include/taler_auditordb_plugin.h               |  4 +-
 src/include/taler_exchangedb_plugin.h              |  4 +-
 10 files changed, 37 insertions(+), 97 deletions(-)

diff --git a/src/auditordb/plugin_auditordb_postgres.c 
b/src/auditordb/plugin_auditordb_postgres.c
index f144746..57f9e89 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -1159,16 +1159,13 @@ postgres_gc (void *cls)
  * @param cls the @e cls of this struct with the plugin-specific state
  * @param session connection to use
  * @param issue issuing information with value, fees and other info about the 
denomination
- * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
+ * @return operation status result
  */
-static int
+static enum GNUNET_DB_QueryStatus
 postgres_insert_denomination_info (void *cls,
                                    struct TALER_AUDITORDB_Session *session,
                                    const struct 
TALER_DenominationKeyValidityPS *issue)
 {
-  PGresult *result;
-  int ret;
-
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (&issue->denom_hash),
     GNUNET_PQ_query_param_auto_from_type (&issue->master),
@@ -1198,20 +1195,9 @@ postgres_insert_denomination_info (void *cls,
                  TALER_amount_cmp_currency_nbo (&issue->value,
                                                &issue->fee_refund));
 
-  result = GNUNET_PQ_exec_prepared (session->conn,
-                                   "auditor_denominations_insert",
-                                   params);
-  if (PGRES_COMMAND_OK != PQresultStatus (result))
-  {
-    ret = GNUNET_SYSERR;
-    BREAK_DB_ERR (result);
-  }
-  else
-  {
-    ret = GNUNET_OK;
-  }
-  PQclear (result);
-  return ret;
+  return GNUNET_PQ_eval_prepared_non_select (session->conn,
+                                            "auditor_denominations_insert",
+                                            params);
 }
 
 
@@ -1237,6 +1223,7 @@ postgres_select_denomination_info (void *cls,
     GNUNET_PQ_query_param_end
   };
   PGresult *result;
+
   result = GNUNET_PQ_exec_prepared (session->conn,
                                     "auditor_denominations_select",
                                     params);
diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c
index bc23f11..858e6bd 100644
--- a/src/auditordb/test_auditordb.c
+++ b/src/auditordb/test_auditordb.c
@@ -19,6 +19,7 @@
  * @author Gabor X Toth
  */
 #include "platform.h"
+#include <gnunet/gnunet_db_lib.h>
 #include "taler_auditordb_lib.h"
 #include "taler_auditordb_plugin.h"
 
@@ -193,7 +194,7 @@ run (void *cls)
   TALER_amount_hton (&issue.fee_refresh, &fee_refresh);
   TALER_amount_hton (&issue.fee_refund, &fee_refund);
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->insert_denomination_info (plugin->cls,
                                             session,
                                             &issue));
diff --git a/src/bank-lib/bank_api_common.c b/src/bank-lib/bank_api_common.c
index e68ba41..738d2a5 100644
--- a/src/bank-lib/bank_api_common.c
+++ b/src/bank-lib/bank_api_common.c
@@ -80,13 +80,12 @@ TALER_BANK_make_auth_header_ (const struct 
TALER_BANK_AuthenticationData *auth)
     authh = append (authh,
                     "X-Taler-Bank-Password",
                     auth->details.basic.password);
-    break;
+    return authh;    
   }
-  return authh;
+  return NULL;
 }
 
 
-
 /**
  * Obtain the URL to use for an API request.
  *
diff --git a/src/exchange/taler-exchange-httpd_keystate.c 
b/src/exchange/taler-exchange-httpd_keystate.c
index 6fc55a0..7c499b0 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -485,11 +485,11 @@ reload_keys_denom_iter (void *cls,
                             session);
       break;
     }
-    res = TEH_plugin->insert_denomination_info (TEH_plugin->cls,
-                                                session,
-                                                &dki->denom_pub,
-                                                &dki->issue);
-    if (GNUNET_OK != res)
+    qs = TEH_plugin->insert_denomination_info (TEH_plugin->cls,
+                                              session,
+                                              &dki->denom_pub,
+                                              &dki->issue);
+    if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
     {
       /* Insert failed!? Very bad error, log and retry */
       GNUNET_break (0);
diff --git a/src/exchange/test_taler_exchange_aggregator.c 
b/src/exchange/test_taler_exchange_aggregator.c
index db22613..7f9ea41 100644
--- a/src/exchange/test_taler_exchange_aggregator.c
+++ b/src/exchange/test_taler_exchange_aggregator.c
@@ -1143,7 +1143,7 @@ run (void *cls)
   if ( (GNUNET_OK !=
         plugin->start (plugin->cls,
                        session)) ||
-       (GNUNET_OK !=
+       (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
         plugin->insert_denomination_info (plugin->cls,
                                           session,
                                           &dpk,
diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.c 
b/src/exchangedb/perf_taler_exchangedb_interpreter.c
index 0a8efbb..2e43075 100644
--- a/src/exchangedb/perf_taler_exchangedb_interpreter.c
+++ b/src/exchangedb/perf_taler_exchangedb_interpreter.c
@@ -1,6 +1,6 @@
 /*
    This file is part of TALER
-   Copyright (C) 2014, 2015 GNUnet e.V.
+   Copyright (C) 2014-2017 GNUnet e.V.
 
    TALER is free software; you can redistribute it and/or modify it under the
    terms of the GNU General Public License as published by the Free Software
@@ -1446,7 +1446,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state 
*state)
       case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION:
         {
           unsigned int denom_index;
-          int ret;
+          enum GNUNET_DB_QueryStatus ret;
           struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki ;
 
           denom_index = 
state->cmd[state->i].details.insert_denomination.index_denom;
@@ -1455,7 +1455,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state 
*state)
                                                          state->session,
                                                          &dki->denom_pub,
                                                          &dki->issue);
-          GNUNET_assert (GNUNET_SYSERR != ret);
+          GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == ret);
         }
         break;
 
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 2eac21c..510f8ce 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -82,53 +82,6 @@
 
 
 /**
- * Shorthand for exit jumps.  Logs the current line number
- * and jumps to the "EXITIF_exit" label.
- *
- * @param cond condition that must be TRUE to exit with an error
- */
-#define EXITIF(cond)                                              \
-  do {                                                            \
-    if (cond) { GNUNET_break (0); goto EXITIF_exit; }             \
-  } while (0)
-
-
-/**
- * Execute an SQL statement and log errors on failure. Must be
- * run in a function that has an "SQLEXEC_fail" label to jump
- * to in case the SQL statement failed.
- *
- * @param conn database connection
- * @param sql SQL statement to run
- */
-#define SQLEXEC_(conn, sql)                                             \
-  do {                                                                  \
-    PGresult *result = PQexec (conn, sql);                              \
-    if (PGRES_COMMAND_OK != PQresultStatus (result))                    \
-    {                                                                   \
-      BREAK_DB_ERR (result, conn);                                      \
-      PQclear (result);                                                 \
-      goto SQLEXEC_fail;                                                \
-    }                                                                   \
-    PQclear (result);                                                   \
-  } while (0)
-
-
-/**
- * Run an SQL statement, ignoring errors and clearing the result.
- *
- * @param conn database connection
- * @param sql SQL statement to run
- */
-#define SQLEXEC_IGNORE_ERROR_(conn, sql)                                \
-  do {                                                                  \
-    PGresult *result = PQexec (conn, sql);                              \
-    PQclear (result);                                                   \
-  } while (0)
-
-
-
-/**
  * Handle for a database session (per-thread, for transactions).
  */
 struct TALER_EXCHANGEDB_Session
@@ -1822,9 +1775,9 @@ execute_prepared_non_select (struct 
TALER_EXCHANGEDB_Session *session,
  * @param session connection to use
  * @param denom_pub the public key used for signing coins of this denomination
  * @param issue issuing information with value, fees and other info about the 
coin
- * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
+ * @return status of the query
  */
-static int
+static enum GNUNET_DB_QueryStatus
 postgres_insert_denomination_info (void *cls,
                                    struct TALER_EXCHANGEDB_Session *session,
                                    const struct TALER_DenominationPublicKey 
*denom_pub,
@@ -1861,9 +1814,9 @@ postgres_insert_denomination_info (void *cls,
                  TALER_amount_cmp_currency_nbo (&issue->properties.value,
                                                &issue->properties.fee_refund));
 
-  return execute_prepared_non_select (session,
-                                      "denomination_insert",
-                                      params);
+  return GNUNET_PQ_eval_prepared_non_select (session->conn,
+                                            "denomination_insert",
+                                            params);
 }
 
 
@@ -1941,10 +1894,14 @@ postgres_get_denomination_info (void *cls,
       GNUNET_PQ_result_spec_end
     };
 
-    EXITIF (GNUNET_OK !=
-            GNUNET_PQ_extract_result (result,
-                                      rs,
-                                      0));
+    if (GNUNET_OK !=
+       GNUNET_PQ_extract_result (result,
+                                 rs,
+                                 0))
+    {
+      PQclear (result);
+      return GNUNET_SYSERR;
+    }
   }
   PQclear (result);
   issue->properties.purpose.size = htonl (sizeof (struct 
TALER_DenominationKeyValidityPS));
@@ -1952,10 +1909,6 @@ postgres_get_denomination_info (void *cls,
   GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
                                      &issue->properties.denom_hash);
   return GNUNET_OK;
-
- EXITIF_exit:
-  PQclear (result);
-  return GNUNET_SYSERR;
 }
 
 
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index fb52ddf..adb7237 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -259,7 +259,7 @@ create_denom_key_pair (unsigned int size,
 
   dki.issue.properties.purpose.size = htonl (sizeof (struct 
TALER_DenominationKeyValidityPS));
   dki.issue.properties.purpose.purpose = htonl 
(TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
-  if (GNUNET_OK !=
+  if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
       plugin->insert_denomination_info (plugin->cls,
                                         session,
                                         &dki.denom_pub,
diff --git a/src/include/taler_auditordb_plugin.h 
b/src/include/taler_auditordb_plugin.h
index 170a68f..e4e6f34 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -275,9 +275,9 @@ struct TALER_AUDITORDB_Plugin
    * @param cls the @e cls of this struct with the plugin-specific state
    * @param session connection to use
    * @param issue issuing information with value, fees and other info about 
the denomination
-   * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
+   * @return status of database operation
    */
-  int
+  enum GNUNET_DB_QueryStatus
   (*insert_denomination_info)(void *cls,
                               struct TALER_AUDITORDB_Session *session,
                               const struct TALER_DenominationKeyValidityPS 
*issue);
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 03020f2..924bfe7 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -1135,9 +1135,9 @@ struct TALER_EXCHANGEDB_Plugin
    * @param session connection to use
    * @param denom_pub the public key used for signing coins of this 
denomination
    * @param issue issuing information with value, fees and other info about 
the denomination
-   * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
+   * @return status of the query
    */
-  int
+  enum GNUNET_DB_QueryStatus
   (*insert_denomination_info) (void *cls,
                                struct TALER_EXCHANGEDB_Session *session,
                                const struct TALER_DenominationPublicKey 
*denom_pub,

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



reply via email to

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