LCOV - code coverage report
Current view: top level - bank-lib - bank_api_helper.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 36 0
Test Date: 2026-04-14 15:39:31 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /*
       2              :   This file is part of TALER
       3              :   Copyright (C) 2026 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
      15              :   <http://www.gnu.org/licenses/>
      16              : */
      17              : /**
      18              :  * @file bank-lib/bank_api_helper.c
      19              :  * @brief convenience functions for the ``struct TALER_BANK_TransferSubject``
      20              :  * @author Christian Grothoff
      21              :  */
      22              : #include "bank_api_common.h"
      23              : #include <microhttpd.h> /* just for HTTP status codes */
      24              : #include "taler/taler_signatures.h"
      25              : 
      26              : 
      27              : void
      28            0 : TALER_BANK_transfer_subject_copy (
      29              :   struct TALER_BANK_TransferSubject *dst,
      30              :   const struct TALER_BANK_TransferSubject *src)
      31              : {
      32            0 :   dst->format = src->format;
      33              : 
      34            0 :   switch (src->format)
      35              :   {
      36            0 :   case TALER_BANK_SUBJECT_FORMAT_SIMPLE:
      37            0 :     dst->details.simple.credit_amount = src->details.simple.credit_amount;
      38            0 :     dst->details.simple.subject =
      39            0 :       (src->details.simple.subject != NULL)
      40            0 :       ? GNUNET_strdup (src->details.simple.subject)
      41            0 :       : NULL;
      42            0 :     return;
      43              : 
      44            0 :   case TALER_BANK_SUBJECT_FORMAT_URI:
      45            0 :     dst->details.uri.uri =
      46            0 :       (src->details.uri.uri != NULL)
      47            0 :       ? GNUNET_strdup (src->details.uri.uri)
      48            0 :       : NULL;
      49            0 :     return;
      50              : 
      51            0 :   case TALER_BANK_SUBJECT_FORMAT_CH_QR_BILL:
      52            0 :     dst->details.ch_qr_bill.credit_amount =
      53              :       src->details.ch_qr_bill.credit_amount;
      54            0 :     dst->details.ch_qr_bill.qr_reference_number =
      55            0 :       (src->details.ch_qr_bill.qr_reference_number != NULL)
      56            0 :       ? GNUNET_strdup (src->details.ch_qr_bill.qr_reference_number)
      57            0 :       : NULL;
      58            0 :     return;
      59              :   }
      60            0 :   GNUNET_break (0);
      61              : }
      62              : 
      63              : 
      64              : void
      65            0 : TALER_BANK_transfer_subject_free (
      66              :   struct TALER_BANK_TransferSubject *subject)
      67              : {
      68            0 :   switch (subject->format)
      69              :   {
      70            0 :   case TALER_BANK_SUBJECT_FORMAT_SIMPLE:
      71            0 :     GNUNET_free (subject->details.simple.subject);
      72            0 :     return;
      73              : 
      74            0 :   case TALER_BANK_SUBJECT_FORMAT_URI:
      75            0 :     GNUNET_free (subject->details.uri.uri);
      76            0 :     return;
      77              : 
      78            0 :   case TALER_BANK_SUBJECT_FORMAT_CH_QR_BILL:
      79            0 :     GNUNET_free (subject->details.ch_qr_bill.qr_reference_number);
      80            0 :     return;
      81              :   }
      82            0 :   GNUNET_break (0);
      83              : }
        

Generated by: LCOV version 2.0-1