free_reserve_history.c (3001B)
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); 48 break; 49 } 50 case TALER_EXCHANGEDB_RO_RECOUP_COIN: 51 { 52 struct TALER_EXCHANGEDB_Recoup *recoup; 53 54 recoup = rh->details.recoup; 55 TALER_denom_sig_free (&recoup->coin.denom_sig); 56 GNUNET_free (recoup); 57 break; 58 } 59 case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK: 60 { 61 struct TALER_EXCHANGEDB_ClosingTransfer *closing; 62 63 closing = rh->details.closing; 64 GNUNET_free (closing->receiver_account_details.full_payto); 65 GNUNET_free (closing); 66 break; 67 } 68 case TALER_EXCHANGEDB_RO_PURSE_MERGE: 69 { 70 struct TALER_EXCHANGEDB_PurseMerge *merge; 71 72 merge = rh->details.merge; 73 GNUNET_free (merge); 74 break; 75 } 76 case TALER_EXCHANGEDB_RO_HISTORY_REQUEST: 77 { 78 struct TALER_EXCHANGEDB_HistoryRequest *history; 79 80 history = rh->details.history; 81 GNUNET_free (history); 82 break; 83 } 84 case TALER_EXCHANGEDB_RO_OPEN_REQUEST: 85 { 86 struct TALER_EXCHANGEDB_OpenRequest *or; 87 88 or = rh->details.open_request; 89 GNUNET_free (or); 90 break; 91 } 92 case TALER_EXCHANGEDB_RO_CLOSE_REQUEST: 93 { 94 struct TALER_EXCHANGEDB_CloseRequest *cr; 95 96 cr = rh->details.close_request; 97 GNUNET_free (cr); 98 break; 99 } 100 } 101 { 102 struct TALER_EXCHANGEDB_ReserveHistory *next; 103 104 next = rh->next; 105 GNUNET_free (rh); 106 rh = next; 107 } 108 } 109 } 110 111 112 /* end of free_reserve_history.c */