gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: avoid duping configuration, star


From: gnunet
Subject: [taler-exchange] branch master updated: avoid duping configuration, start to use PQ_connect_with_cfg
Date: Sun, 09 Feb 2020 15:53:31 +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 ae5583f0 avoid duping configuration, start to use PQ_connect_with_cfg
ae5583f0 is described below

commit ae5583f04434cf39a5ae7a6f623bfc76322f9eb3
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Feb 9 15:53:28 2020 +0100

    avoid duping configuration, start to use PQ_connect_with_cfg
---
 src/auditordb/auditordb_plugin.c            |  5 +----
 src/auditordb/plugin_auditordb_postgres.c   |  2 +-
 src/exchangedb/exchangedb_plugin.c          |  6 ++----
 src/exchangedb/plugin_exchangedb_postgres.c | 17 ++++++++++++-----
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/auditordb/auditordb_plugin.c b/src/auditordb/auditordb_plugin.c
index 19717fe8..d04e8815 100644
--- a/src/auditordb/auditordb_plugin.c
+++ b/src/auditordb/auditordb_plugin.c
@@ -35,7 +35,6 @@ TALER_AUDITORDB_plugin_load (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
 {
   char *plugin_name;
   char *lib_name;
-  struct GNUNET_CONFIGURATION_Handle *cfg_dup;
   struct TALER_AUDITORDB_Plugin *plugin;
 
   if (GNUNET_SYSERR ==
@@ -53,14 +52,12 @@ TALER_AUDITORDB_plugin_load (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
                           "libtaler_plugin_auditordb_%s",
                           plugin_name);
   GNUNET_free (plugin_name);
-  cfg_dup = GNUNET_CONFIGURATION_dup (cfg);
   plugin = GNUNET_PLUGIN_load (lib_name,
-                               cfg_dup);
+                               (void *) cfg);
   if (NULL != plugin)
     plugin->library_name = lib_name;
   else
     GNUNET_free (lib_name);
-  GNUNET_CONFIGURATION_destroy (cfg_dup);
   return plugin;
 }
 
diff --git a/src/auditordb/plugin_auditordb_postgres.c 
b/src/auditordb/plugin_auditordb_postgres.c
index 30db303b..08d24fd7 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -3244,7 +3244,7 @@ postgres_get_predicted_balance (void *cls,
 void *
 libtaler_plugin_auditordb_postgres_init (void *cls)
 {
-  struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
   struct PostgresClosure *pg;
   struct TALER_AUDITORDB_Plugin *plugin;
   const char *ec;
diff --git a/src/exchangedb/exchangedb_plugin.c 
b/src/exchangedb/exchangedb_plugin.c
index 8e61f860..f4c2eea9 100644
--- a/src/exchangedb/exchangedb_plugin.c
+++ b/src/exchangedb/exchangedb_plugin.c
@@ -35,7 +35,6 @@ TALER_EXCHANGEDB_plugin_load (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
 {
   char *plugin_name;
   char *lib_name;
-  struct GNUNET_CONFIGURATION_Handle *cfg_dup;
   struct TALER_EXCHANGEDB_Plugin *plugin;
 
   if (GNUNET_SYSERR ==
@@ -53,13 +52,12 @@ TALER_EXCHANGEDB_plugin_load (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
                           "libtaler_plugin_exchangedb_%s",
                           plugin_name);
   GNUNET_free (plugin_name);
-  cfg_dup = GNUNET_CONFIGURATION_dup (cfg);
-  plugin = GNUNET_PLUGIN_load (lib_name, cfg_dup);
+  plugin = GNUNET_PLUGIN_load (lib_name,
+                               (void *) cfg);
   if (NULL != plugin)
     plugin->library_name = lib_name;
   else
     GNUNET_free (lib_name);
-  GNUNET_CONFIGURATION_destroy (cfg_dup);
   return plugin;
 }
 
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 4d0b1bb6..fe0021fa 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -108,6 +108,11 @@ struct PostgresClosure
    */
   pthread_key_t db_conn_threadlocal;
 
+  /**
+   * Our configuration.
+   */
+  const struct GNUNET_CONFIGURATION_Handle *cfg;
+
   /**
    * Database connection string, as read from
    * the configuration.
@@ -187,10 +192,11 @@ postgres_create_tables (void *cls)
   struct PostgresClosure *pc = cls;
   struct GNUNET_PQ_Context *conn;
 
-  conn = GNUNET_PQ_connect (pc->connection_cfg_str,
-                            pc->sql_dir,
-                            NULL,
-                            NULL);
+  conn = GNUNET_PQ_connect_with_cfg (pc->cfg,
+                                     "exchangedb-postgres",
+                                     "",
+                                     NULL,
+                                     NULL);
   if (NULL == conn)
     return GNUNET_SYSERR;
   GNUNET_PQ_disconnect (conn);
@@ -7212,12 +7218,13 @@ postgres_select_deposits_missing_wire (void *cls,
 void *
 libtaler_plugin_exchangedb_postgres_init (void *cls)
 {
-  struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
   struct PostgresClosure *pg;
   struct TALER_EXCHANGEDB_Plugin *plugin;
   const char *ec;
 
   pg = GNUNET_new (struct PostgresClosure);
+  pg->cfg = cfg;
   pg->main_self = pthread_self (); /* loaded while single-threaded! */
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (cfg,

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



reply via email to

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