exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

free_reserve_history.c (3042B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2015, 2016, 2020, 2024 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/free_reserve_history.c
     18  * @brief Function to free a reserve history
     19  * @author Christian Grothoff
     20  */
     21 #include "platform.h"
     22 #include "exchange-database/free_reserve_history.h"
     23 
     24 
     25 void
     26 TALER_EXCHANGEDB_free_reserve_history (
     27   struct TALER_EXCHANGEDB_ReserveHistory *rh)
     28 {
     29   while (NULL != rh)
     30   {
     31     switch (rh->type)
     32     {
     33     case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
     34       {
     35         struct TALER_EXCHANGEDB_BankTransfer *bt;
     36 
     37         bt = rh->details.bank;
     38         GNUNET_free (bt->sender_account_details.full_payto);
     39         GNUNET_free (bt);
     40         break;
     41       }
     42     case TALER_EXCHANGEDB_RO_WITHDRAW_COINS:
     43       {
     44         struct TALER_EXCHANGEDB_Withdraw *wd;
     45         wd = rh->details.withdraw;
     46         GNUNET_free (wd->denom_pub_hashes);
     47         GNUNET_free (wd->denom_serials);
     48         GNUNET_free (wd);
     49         break;
     50       }
     51     case TALER_EXCHANGEDB_RO_RECOUP_COIN:
     52       {
     53         struct TALER_EXCHANGEDB_Recoup *recoup;
     54 
     55         recoup = rh->details.recoup;
     56         TALER_denom_sig_free (&recoup->coin.denom_sig);
     57         GNUNET_free (recoup);
     58         break;
     59       }
     60     case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
     61       {
     62         struct TALER_EXCHANGEDB_ClosingTransfer *closing;
     63 
     64         closing = rh->details.closing;
     65         GNUNET_free (closing->receiver_account_details.full_payto);
     66         GNUNET_free (closing);
     67         break;
     68       }
     69     case TALER_EXCHANGEDB_RO_PURSE_MERGE:
     70       {
     71         struct TALER_EXCHANGEDB_PurseMerge *merge;
     72 
     73         merge = rh->details.merge;
     74         GNUNET_free (merge);
     75         break;
     76       }
     77     case TALER_EXCHANGEDB_RO_HISTORY_REQUEST:
     78       {
     79         struct TALER_EXCHANGEDB_HistoryRequest *history;
     80 
     81         history = rh->details.history;
     82         GNUNET_free (history);
     83         break;
     84       }
     85     case TALER_EXCHANGEDB_RO_OPEN_REQUEST:
     86       {
     87         struct TALER_EXCHANGEDB_OpenRequest *or;
     88 
     89         or = rh->details.open_request;
     90         GNUNET_free (or);
     91         break;
     92       }
     93     case TALER_EXCHANGEDB_RO_CLOSE_REQUEST:
     94       {
     95         struct TALER_EXCHANGEDB_CloseRequest *cr;
     96 
     97         cr = rh->details.close_request;
     98         GNUNET_free (cr);
     99         break;
    100       }
    101     }
    102     {
    103       struct TALER_EXCHANGEDB_ReserveHistory *next;
    104 
    105       next = rh->next;
    106       GNUNET_free (rh);
    107       rh = next;
    108     }
    109   }
    110 }
    111 
    112 
    113 /* end of free_reserve_history.c */