LCOV - code coverage report
Current view: top level - backenddb - merchantdb_helper.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 65.0 % 60 39
Test Date: 2025-12-02 20:17:27 Functions: 57.1 % 7 4

            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 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 "taler_merchantdb_lib.h"
      25              : 
      26              : 
      27              : void
      28           49 : TALER_MERCHANTDB_product_details_free (
      29              :   struct TALER_MERCHANTDB_ProductDetails *pd)
      30              : {
      31           49 :   GNUNET_free (pd->product_name);
      32           49 :   GNUNET_free (pd->description);
      33           49 :   json_decref (pd->description_i18n);
      34           49 :   pd->description_i18n = NULL;
      35           49 :   GNUNET_free (pd->unit);
      36           49 :   json_decref (pd->taxes);
      37           49 :   pd->taxes = NULL;
      38           49 :   GNUNET_free (pd->image);
      39           49 :   json_decref (pd->address);
      40           49 :   pd->address = NULL;
      41           49 :   GNUNET_free (pd->price_array);
      42           49 :   pd->price_array = NULL;
      43           49 :   pd->price_array_length = 0;
      44           49 : }
      45              : 
      46              : 
      47              : void
      48           24 : TALER_MERCHANTDB_template_details_free (
      49              :   struct TALER_MERCHANTDB_TemplateDetails *tp)
      50              : {
      51           24 :   GNUNET_free (tp->template_description);
      52           24 :   GNUNET_free (tp->otp_id);
      53           24 :   json_decref (tp->editable_defaults);
      54           24 :   tp->editable_defaults = NULL;
      55           24 :   json_decref (tp->template_contract);
      56           24 :   tp->template_contract = NULL;
      57           24 : }
      58              : 
      59              : 
      60              : void
      61            6 : TALER_MERCHANTDB_webhook_details_free (
      62              :   struct TALER_MERCHANTDB_WebhookDetails *wb)
      63              : {
      64            6 :   GNUNET_free (wb->event_type);
      65            6 :   GNUNET_free (wb->url);
      66            6 :   GNUNET_free (wb->http_method);
      67            6 :   GNUNET_free (wb->header_template);
      68            6 :   GNUNET_free (wb->body_template);
      69            6 : }
      70              : 
      71              : 
      72              : void
      73            0 : TALER_MERCHANTDB_pending_webhook_details_free (
      74              :   struct TALER_MERCHANTDB_PendingWebhookDetails *pwb)
      75              : {
      76            0 :   GNUNET_free (pwb->url);
      77            0 :   GNUNET_free (pwb->http_method);
      78            0 :   GNUNET_free (pwb->header);
      79            0 :   GNUNET_free (pwb->body);
      80            0 : }
      81              : 
      82              : 
      83              : void
      84            0 : TALER_MERCHANTDB_token_family_details_free (
      85              :   struct TALER_MERCHANTDB_TokenFamilyDetails *tf)
      86              : {
      87            0 :   GNUNET_free (tf->slug);
      88            0 :   GNUNET_free (tf->name);
      89            0 :   GNUNET_free (tf->description);
      90            0 :   json_decref (tf->description_i18n);
      91            0 :   tf->description_i18n = NULL;
      92            0 :   json_decref (tf->extra_data);
      93            0 :   tf->extra_data = NULL;
      94            0 :   GNUNET_free (tf->cipher_spec);
      95            0 : }
      96              : 
      97              : 
      98              : void
      99            0 : TALER_MERCHANTDB_category_details_free (
     100              :   struct TALER_MERCHANTDB_CategoryDetails *cd)
     101              : {
     102            0 :   GNUNET_free (cd->category_name);
     103            0 :   json_decref (cd->category_name_i18n);
     104            0 :   cd->category_name_i18n = NULL;
     105            0 : }
     106              : 
     107              : 
     108              : void
     109           40 : TALER_MERCHANTDB_unit_details_free (
     110              :   struct TALER_MERCHANTDB_UnitDetails *ud)
     111              : {
     112           40 :   GNUNET_free (ud->unit);
     113           40 :   GNUNET_free (ud->unit_name_long);
     114           40 :   GNUNET_free (ud->unit_name_short);
     115           40 :   json_decref (ud->unit_name_long_i18n);
     116           40 :   ud->unit_name_long_i18n = NULL;
     117           40 :   json_decref (ud->unit_name_short_i18n);
     118           40 :   ud->unit_name_short_i18n = NULL;
     119           40 : }
     120              : 
     121              : 
     122              : /* end of merchantdb_helper.c */
        

Generated by: LCOV version 2.0-1