LCOV - code coverage report
Current view: top level - backenddb - merchantdb_helper.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 82.0 % 61 50
Test Date: 2026-09-04 23:42:01 Functions: 71.4 % 7 5

            Line data    Source code
       1              : /*
       2              :   This file is part of TALER
       3              :   Copyright (C) 2021 Taler Systems SA
       4              : 
       5              :   TALER is free software; you can redistribute it and/or modify it under the
       6              :   terms of the GNU Lesser 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 src/backenddb/merchantdb_helper.c
      18              :  * @brief Helper functions for the merchant database logic
      19              :  * @author Christian Grothoff
      20              :  * @author Priscilla Huang
      21              :  */
      22              : #include "platform.h"
      23              : #include <taler/taler_util.h>
      24              : #include "merchantdb_lib.h"
      25              : 
      26              : 
      27              : void
      28          102 : TALER_MERCHANTDB_product_details_free (
      29              :   struct TALER_MERCHANTDB_ProductDetails *pd)
      30              : {
      31          102 :   GNUNET_free (pd->product_name);
      32          102 :   GNUNET_free (pd->description);
      33          102 :   json_decref (pd->description_i18n);
      34          102 :   pd->description_i18n = NULL;
      35          102 :   GNUNET_free (pd->unit);
      36          102 :   json_decref (pd->taxes);
      37          102 :   pd->taxes = NULL;
      38          102 :   GNUNET_free (pd->image);
      39          102 :   GNUNET_free (pd->image_hash);
      40          102 :   json_decref (pd->address);
      41          102 :   pd->address = NULL;
      42          102 :   GNUNET_free (pd->price_array);
      43          102 :   pd->price_array = NULL;
      44          102 :   pd->price_array_length = 0;
      45          102 : }
      46              : 
      47              : 
      48              : void
      49           68 : TALER_MERCHANTDB_template_details_free (
      50              :   struct TALER_MERCHANTDB_TemplateDetails *tp)
      51              : {
      52           68 :   GNUNET_free (tp->template_description);
      53           68 :   GNUNET_free (tp->otp_id);
      54           68 :   json_decref (tp->editable_defaults);
      55           68 :   tp->editable_defaults = NULL;
      56           68 :   json_decref (tp->template_contract);
      57           68 :   tp->template_contract = NULL;
      58           68 : }
      59              : 
      60              : 
      61              : void
      62            6 : TALER_MERCHANTDB_webhook_details_free (
      63              :   struct TALER_MERCHANTDB_WebhookDetails *wb)
      64              : {
      65            6 :   GNUNET_free (wb->event_type);
      66            6 :   GNUNET_free (wb->url);
      67            6 :   GNUNET_free (wb->http_method);
      68            6 :   GNUNET_free (wb->header_template);
      69            6 :   GNUNET_free (wb->body_template);
      70            6 : }
      71              : 
      72              : 
      73              : void
      74            0 : TALER_MERCHANTDB_pending_webhook_details_free (
      75              :   struct TALER_MERCHANTDB_PendingWebhookDetails *pwb)
      76              : {
      77            0 :   GNUNET_free (pwb->url);
      78            0 :   GNUNET_free (pwb->http_method);
      79            0 :   GNUNET_free (pwb->header);
      80            0 :   GNUNET_free (pwb->body);
      81            0 : }
      82              : 
      83              : 
      84              : void
      85            7 : TALER_MERCHANTDB_token_family_details_free (
      86              :   struct TALER_MERCHANTDB_TokenFamilyDetails *tf)
      87              : {
      88            7 :   GNUNET_free (tf->slug);
      89            7 :   GNUNET_free (tf->name);
      90            7 :   GNUNET_free (tf->description);
      91            7 :   json_decref (tf->description_i18n);
      92            7 :   tf->description_i18n = NULL;
      93            7 :   json_decref (tf->extra_data);
      94            7 :   tf->extra_data = NULL;
      95            7 :   GNUNET_free (tf->cipher_spec);
      96            7 : }
      97              : 
      98              : 
      99              : void
     100            0 : TALER_MERCHANTDB_category_details_free (
     101              :   struct TALER_MERCHANTDB_CategoryDetails *cd)
     102              : {
     103            0 :   GNUNET_free (cd->category_name);
     104            0 :   json_decref (cd->category_name_i18n);
     105            0 :   cd->category_name_i18n = NULL;
     106            0 : }
     107              : 
     108              : 
     109              : void
     110           74 : TALER_MERCHANTDB_unit_details_free (
     111              :   struct TALER_MERCHANTDB_UnitDetails *ud)
     112              : {
     113           74 :   GNUNET_free (ud->unit);
     114           74 :   GNUNET_free (ud->unit_name_long);
     115           74 :   GNUNET_free (ud->unit_name_short);
     116           74 :   json_decref (ud->unit_name_long_i18n);
     117           74 :   ud->unit_name_long_i18n = NULL;
     118           74 :   json_decref (ud->unit_name_short_i18n);
     119           74 :   ud->unit_name_short_i18n = NULL;
     120           74 : }
     121              : 
     122              : 
     123              : /* end of merchantdb_helper.c */
        

Generated by: LCOV version 2.0-1