gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: [build] donaudb_plugin.c, donaudb_t


From: gnunet
Subject: [taler-donau] branch master updated: [build] donaudb_plugin.c, donaudb_transactions.c, donaudb_lib.h
Date: Mon, 27 Nov 2023 22:11:06 +0100

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

pius-loosli pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 69eb682  [build] donaudb_plugin.c, donaudb_transactions.c, 
donaudb_lib.h
69eb682 is described below

commit 69eb6823438aa1f567cbf66c600b81f53039df17
Author: Pius Loosli <loosp2@bfh.ch>
AuthorDate: Mon Nov 27 22:09:35 2023 +0100

    [build] donaudb_plugin.c, donaudb_transactions.c, donaudb_lib.h
---
 src/donaudb/donaudb_plugin.c       |  80 ++++-----
 src/donaudb/donaudb_transactions.c | 334 ++++++++++++++++++-------------------
 src/include/donaudb_lib.h          |   8 +-
 3 files changed, 211 insertions(+), 211 deletions(-)

diff --git a/src/donaudb/donaudb_plugin.c b/src/donaudb/donaudb_plugin.c
index 49eaf8b..40fd69e 100644
--- a/src/donaudb/donaudb_plugin.c
+++ b/src/donaudb/donaudb_plugin.c
@@ -24,50 +24,50 @@
 #include <ltdl.h>
 
 
-struct DONAUDB_Plugin *
-DONAUDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *plugin_name;
-  char *lib_name;
-  struct DONAUDB_Plugin *plugin;
+// struct DONAUDB_Plugin *
+// DONAUDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
+// {
+//   char *plugin_name;
+//   char *lib_name;
+//   struct DONAUDB_Plugin *plugin;
 
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_string (cfg,
-                                             "donau",
-                                             "db",
-                                             &plugin_name))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "donau",
-                               "db");
-    return NULL;
-  }
-  GNUNET_asprintf (&lib_name,
-                   "libtaler_plugin_donaudb_%s",
-                   plugin_name);
-  GNUNET_free (plugin_name);
-  plugin = GNUNET_PLUGIN_load (lib_name,
-                               (void *) cfg);
-  if (NULL != plugin)
-    plugin->library_name = lib_name;
-  else
-    GNUNET_free (lib_name);
-  return plugin;
-}
+//   if (GNUNET_SYSERR ==
+//       GNUNET_CONFIGURATION_get_value_string (cfg,
+//                                              "donau",
+//                                              "db",
+//                                              &plugin_name))
+//   {
+//     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+//                                "donau",
+//                                "db");
+//     return NULL;
+//   }
+//   GNUNET_asprintf (&lib_name,
+//                    "libtaler_plugin_donaudb_%s",
+//                    plugin_name);
+//   GNUNET_free (plugin_name);
+//   plugin = GNUNET_PLUGIN_load (lib_name,
+//                                (void *) cfg);
+//   if (NULL != plugin)
+//     plugin->library_name = lib_name;
+//   else
+//     GNUNET_free (lib_name);
+//   return plugin;
+// }
 
 
-void
-DONAUDB_plugin_unload (struct DONAUDB_Plugin *plugin)
-{
-  char *lib_name;
+// void
+// DONAUDB_plugin_unload (struct DONAUDB_Plugin *plugin)
+// {
+//   char *lib_name;
 
-  if (NULL == plugin)
-    return;
-  lib_name = plugin->library_name;
-  GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name,
-                                               plugin));
-  GNUNET_free (lib_name);
-}
+//   if (NULL == plugin)
+//     return;
+//   lib_name = plugin->library_name;
+//   GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name,
+//                                                plugin));
+//   GNUNET_free (lib_name);
+// }
 
 
 /* end of donaudb_plugin.c */
diff --git a/src/donaudb/donaudb_transactions.c 
b/src/donaudb/donaudb_transactions.c
index 125bfb8..b26932c 100644
--- a/src/donaudb/donaudb_transactions.c
+++ b/src/donaudb/donaudb_transactions.c
@@ -18,173 +18,173 @@
  * @brief Logic to compute transaction totals of a transaction list for a coin
  * @author Christian Grothoff
  */
-#include "platform.h"
-#include "taler_donaudb_lib.h"
+#include "taler/platform.h"
+#include "donaudb_lib.h"
 
 
-enum GNUNET_GenericReturnValue
-DONAUDB_calculate_transaction_list_totals (
-  struct DONAUDB_TransactionList *tl,
-  const struct TALER_Amount *off,
-  struct TALER_Amount *ret)
-{
-  struct TALER_Amount spent = *off;
-  struct TALER_Amount refunded;
-  struct TALER_Amount deposit_fee;
-  bool have_refund;
+// enum GNUNET_GenericReturnValue
+// DONAUDB_calculate_transaction_list_totals (
+//   struct DONAUDB_TransactionList *tl,
+//   const struct TALER_Amount *off,
+//   struct TALER_Amount *ret)
+// {
+//   struct TALER_Amount spent = *off;
+//   struct TALER_Amount refunded;
+//   struct TALER_Amount deposit_fee;
+//   bool have_refund;
 
-  GNUNET_assert (GNUNET_OK ==
-                 TALER_amount_set_zero (spent.currency,
-                                        &refunded));
-  have_refund = false;
-  for (struct DONAUDB_TransactionList *pos = tl;
-       NULL != pos;
-       pos = pos->next)
-  {
-    switch (pos->type)
-    {
-    case DONAUDB_TT_DEPOSIT:
-      /* spent += pos->amount_with_fee */
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.deposit->amount_with_fee))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      deposit_fee = pos->details.deposit->deposit_fee;
-      break;
-    case DONAUDB_TT_MELT:
-      /* spent += pos->amount_with_fee */
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.melt->amount_with_fee))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      break;
-    case DONAUDB_TT_REFUND:
-      /* refunded += pos->refund_amount - pos->refund_fee */
-      if (0 >
-          TALER_amount_add (&refunded,
-                            &refunded,
-                            &pos->details.refund->refund_amount))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.refund->refund_fee))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      have_refund = true;
-      break;
-    case DONAUDB_TT_OLD_COIN_RECOUP:
-      /* refunded += pos->value */
-      if (0 >
-          TALER_amount_add (&refunded,
-                            &refunded,
-                            &pos->details.old_coin_recoup->value))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      break;
-    case DONAUDB_TT_RECOUP:
-      /* spent += pos->value */
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.recoup->value))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      break;
-    case DONAUDB_TT_RECOUP_REFRESH:
-      /* spent += pos->value */
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.recoup_refresh->value))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      break;
-    case DONAUDB_TT_PURSE_DEPOSIT:
-      /* spent += pos->amount_with_fee */
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.purse_deposit->amount))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      deposit_fee = pos->details.purse_deposit->deposit_fee;
-      break;
-    case DONAUDB_TT_PURSE_REFUND:
-      /* refunded += pos->refund_amount - pos->refund_fee */
-      if (0 >
-          TALER_amount_add (&refunded,
-                            &refunded,
-                            &pos->details.purse_refund->refund_amount))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.purse_refund->refund_fee))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      have_refund = true;
-      break;
-    case DONAUDB_TT_RESERVE_OPEN:
-      /* spent += pos->amount_with_fee */
-      if (0 >
-          TALER_amount_add (&spent,
-                            &spent,
-                            &pos->details.reserve_open->coin_contribution))
-      {
-        GNUNET_break (0);
-        return GNUNET_SYSERR;
-      }
-      break;
-    }
-  }
-  if (have_refund)
-  {
-    /* If we gave any refund, also discount ONE deposit fee */
-    if (0 >
-        TALER_amount_add (&refunded,
-                          &refunded,
-                          &deposit_fee))
-    {
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-  }
-  /* spent = spent - refunded */
-  if (0 >
-      TALER_amount_subtract (&spent,
-                             &spent,
-                             &refunded))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  *ret = spent;
-  return GNUNET_OK;
-}
+//   GNUNET_assert (GNUNET_OK ==
+//                  TALER_amount_set_zero (spent.currency,
+//                                         &refunded));
+//   have_refund = false;
+//   for (struct DONAUDB_TransactionList *pos = tl;
+//        NULL != pos;
+//        pos = pos->next)
+//   {
+//     switch (pos->type)
+//     {
+//     case DONAUDB_TT_DEPOSIT:
+//       /* spent += pos->amount_with_fee */
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.deposit->amount_with_fee))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       deposit_fee = pos->details.deposit->deposit_fee;
+//       break;
+//     case DONAUDB_TT_MELT:
+//       /* spent += pos->amount_with_fee */
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.melt->amount_with_fee))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       break;
+//     case DONAUDB_TT_REFUND:
+//       /* refunded += pos->refund_amount - pos->refund_fee */
+//       if (0 >
+//           TALER_amount_add (&refunded,
+//                             &refunded,
+//                             &pos->details.refund->refund_amount))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.refund->refund_fee))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       have_refund = true;
+//       break;
+//     case DONAUDB_TT_OLD_COIN_RECOUP:
+//       /* refunded += pos->value */
+//       if (0 >
+//           TALER_amount_add (&refunded,
+//                             &refunded,
+//                             &pos->details.old_coin_recoup->value))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       break;
+//     case DONAUDB_TT_RECOUP:
+//       /* spent += pos->value */
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.recoup->value))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       break;
+//     case DONAUDB_TT_RECOUP_REFRESH:
+//       /* spent += pos->value */
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.recoup_refresh->value))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       break;
+//     case DONAUDB_TT_PURSE_DEPOSIT:
+//       /* spent += pos->amount_with_fee */
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.purse_deposit->amount))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       deposit_fee = pos->details.purse_deposit->deposit_fee;
+//       break;
+//     case DONAUDB_TT_PURSE_REFUND:
+//       /* refunded += pos->refund_amount - pos->refund_fee */
+//       if (0 >
+//           TALER_amount_add (&refunded,
+//                             &refunded,
+//                             &pos->details.purse_refund->refund_amount))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.purse_refund->refund_fee))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       have_refund = true;
+//       break;
+//     case DONAUDB_TT_RESERVE_OPEN:
+//       /* spent += pos->amount_with_fee */
+//       if (0 >
+//           TALER_amount_add (&spent,
+//                             &spent,
+//                             &pos->details.reserve_open->coin_contribution))
+//       {
+//         GNUNET_break (0);
+//         return GNUNET_SYSERR;
+//       }
+//       break;
+//     }
+//   }
+//   if (have_refund)
+//   {
+//     /* If we gave any refund, also discount ONE deposit fee */
+//     if (0 >
+//         TALER_amount_add (&refunded,
+//                           &refunded,
+//                           &deposit_fee))
+//     {
+//       GNUNET_break (0);
+//       return GNUNET_SYSERR;
+//     }
+//   }
+//   /* spent = spent - refunded */
+//   if (0 >
+//       TALER_amount_subtract (&spent,
+//                              &spent,
+//                              &refunded))
+//   {
+//     GNUNET_break (0);
+//     return GNUNET_SYSERR;
+//   }
+//   *ret = spent;
+//   return GNUNET_OK;
+// }
diff --git a/src/include/donaudb_lib.h b/src/include/donaudb_lib.h
index 255f04c..4fb8ae8 100644
--- a/src/include/donaudb_lib.h
+++ b/src/include/donaudb_lib.h
@@ -28,8 +28,8 @@ COPYING.If not, see <http:                        // 
www.gnu.org/licenses/>
 #define DONAUDB_LIB_H
 
 #include "taler_signatures.h"
-#include "taler_donaudb_plugin.h"
-#include "taler_bank_service.h"
+#include "donaudb_plugin.h"
+#include "taler/taler_bank_service.h"
 
 
 /**
@@ -87,7 +87,7 @@ struct DONAUDB_AccountInfo
   bool credit_enabled;
 };
 
-
+struct DONAUDB_TransactionList;
 /**
  * Calculate the total value of all transactions performed.
  * Stores @a off plus the cost of all transactions in @a tl
@@ -126,7 +126,7 @@ typedef void
  */
 void
 DONAUDB_find_accounts (DONAUDB_AccountCallback cb,
-                             void *cb_cls);
+                       void *cb_cls);
 
 
 /**

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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