LCOV - code coverage report
Current view: top level - exchangedb - plugin_exchangedb_common.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 0 73 0.0 %
Date: 2022-08-25 06:15:09 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2015, 2016, 2020 Taler Systems SA
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify it under the
       6             :   terms of the GNU General Public License as published by the Free Software
       7             :   Foundation; either version 3, or (at your option) any later version.
       8             : 
       9             :   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
      10             :   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
      11             :   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
      12             : 
      13             :   You should have received a copy of the GNU General Public License along with
      14             :   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
      15             : */
      16             : /**
      17             :  * @file exchangedb/plugin_exchangedb_common.c
      18             :  * @brief Functions shared across plugins, this file is meant to be
      19             :  *        included in each plugin.
      20             :  * @author Christian Grothoff
      21             :  */
      22             : 
      23             : /**
      24             :  * Free memory associated with the given reserve history.
      25             :  *
      26             :  * @param cls the @e cls of this struct with the plugin-specific state (unused)
      27             :  * @param rh history to free.
      28             :  */
      29             : static void
      30           0 : common_free_reserve_history (void *cls,
      31             :                              struct TALER_EXCHANGEDB_ReserveHistory *rh)
      32             : {
      33             :   (void) cls;
      34           0 :   while (NULL != rh)
      35             :   {
      36           0 :     switch (rh->type)
      37             :     {
      38           0 :     case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
      39             :       {
      40             :         struct TALER_EXCHANGEDB_BankTransfer *bt;
      41             : 
      42           0 :         bt = rh->details.bank;
      43           0 :         GNUNET_free (bt->sender_account_details);
      44           0 :         GNUNET_free (bt);
      45           0 :         break;
      46             :       }
      47           0 :     case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
      48             :       {
      49             :         struct TALER_EXCHANGEDB_CollectableBlindcoin *cbc;
      50             : 
      51           0 :         cbc = rh->details.withdraw;
      52           0 :         TALER_blinded_denom_sig_free (&cbc->sig);
      53           0 :         GNUNET_free (cbc);
      54           0 :         break;
      55             :       }
      56           0 :     case TALER_EXCHANGEDB_RO_RECOUP_COIN:
      57             :       {
      58             :         struct TALER_EXCHANGEDB_Recoup *recoup;
      59             : 
      60           0 :         recoup = rh->details.recoup;
      61           0 :         TALER_denom_sig_free (&recoup->coin.denom_sig);
      62           0 :         GNUNET_free (recoup);
      63           0 :         break;
      64             :       }
      65           0 :     case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
      66             :       {
      67             :         struct TALER_EXCHANGEDB_ClosingTransfer *closing;
      68             : 
      69           0 :         closing = rh->details.closing;
      70           0 :         GNUNET_free (closing->receiver_account_details);
      71           0 :         GNUNET_free (closing);
      72           0 :         break;
      73             :       }
      74           0 :     case TALER_EXCHANGEDB_RO_PURSE_MERGE:
      75             :       {
      76             :         struct TALER_EXCHANGEDB_PurseMerge *merge;
      77             : 
      78           0 :         merge = rh->details.merge;
      79           0 :         GNUNET_free (merge);
      80           0 :         break;
      81             :       }
      82           0 :     case TALER_EXCHANGEDB_RO_HISTORY_REQUEST:
      83             :       {
      84             :         struct TALER_EXCHANGEDB_HistoryRequest *history;
      85             : 
      86           0 :         history = rh->details.history;
      87           0 :         GNUNET_free (history);
      88           0 :         break;
      89             :       }
      90             :     }
      91           0 :     {
      92             :       struct TALER_EXCHANGEDB_ReserveHistory *next;
      93             : 
      94           0 :       next = rh->next;
      95           0 :       GNUNET_free (rh);
      96           0 :       rh = next;
      97             :     }
      98             :   }
      99           0 : }
     100             : 
     101             : 
     102             : /**
     103             :  * Free linked list of transactions.
     104             :  *
     105             :  * @param cls the @e cls of this struct with the plugin-specific state (unused)
     106             :  * @param tl list to free
     107             :  */
     108             : static void
     109           0 : common_free_coin_transaction_list (void *cls,
     110             :                                    struct TALER_EXCHANGEDB_TransactionList *tl)
     111             : {
     112             :   (void) cls;
     113           0 :   while (NULL != tl)
     114             :   {
     115           0 :     switch (tl->type)
     116             :     {
     117           0 :     case TALER_EXCHANGEDB_TT_DEPOSIT:
     118             :       {
     119             :         struct TALER_EXCHANGEDB_DepositListEntry *deposit;
     120             : 
     121           0 :         deposit = tl->details.deposit;
     122           0 :         GNUNET_free (deposit->receiver_wire_account);
     123           0 :         GNUNET_free (deposit);
     124           0 :         break;
     125             :       }
     126           0 :     case TALER_EXCHANGEDB_TT_MELT:
     127           0 :       GNUNET_free (tl->details.melt);
     128           0 :       break;
     129           0 :     case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
     130             :       {
     131             :         struct TALER_EXCHANGEDB_RecoupRefreshListEntry *rr;
     132             : 
     133           0 :         rr = tl->details.old_coin_recoup;
     134           0 :         TALER_denom_sig_free (&rr->coin.denom_sig);
     135           0 :         GNUNET_free (rr);
     136           0 :         break;
     137             :       }
     138           0 :     case TALER_EXCHANGEDB_TT_REFUND:
     139           0 :       GNUNET_free (tl->details.refund);
     140           0 :       break;
     141           0 :     case TALER_EXCHANGEDB_TT_RECOUP:
     142           0 :       GNUNET_free (tl->details.recoup);
     143           0 :       break;
     144           0 :     case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
     145             :       {
     146             :         struct TALER_EXCHANGEDB_RecoupRefreshListEntry *rr;
     147             : 
     148           0 :         rr = tl->details.recoup_refresh;
     149           0 :         TALER_denom_sig_free (&rr->coin.denom_sig);
     150           0 :         GNUNET_free (rr);
     151           0 :         break;
     152             :       }
     153           0 :     case TALER_EXCHANGEDB_TT_PURSE_DEPOSIT:
     154             :       {
     155             :         struct TALER_EXCHANGEDB_PurseDepositListEntry *deposit;
     156             : 
     157           0 :         deposit = tl->details.purse_deposit;
     158           0 :         GNUNET_free (deposit->exchange_base_url);
     159           0 :         GNUNET_free (deposit);
     160           0 :         break;
     161             :       }
     162             :     }
     163           0 :     {
     164             :       struct TALER_EXCHANGEDB_TransactionList *next;
     165             : 
     166           0 :       next = tl->next;
     167           0 :       GNUNET_free (tl);
     168           0 :       tl = next;
     169             :     }
     170             :   }
     171           0 : }
     172             : 
     173             : 
     174             : /* end of plugin_exchangedb_common.c */

Generated by: LCOV version 1.14