gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: make version field const


From: gnunet
Subject: [taler-exchange] branch master updated: make version field const
Date: Tue, 07 Apr 2020 11:47:50 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new aa652476 make version field const
aa652476 is described below

commit aa65247662d5f363e66ba73bc99448a607b486b7
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Apr 7 11:47:47 2020 +0200

    make version field const
---
 src/include/taler_auditor_service.h |  2 +-
 src/lib/auditor_api_handle.c        | 29 +++++++++++------------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/include/taler_auditor_service.h 
b/src/include/taler_auditor_service.h
index fdce76cd..27959a88 100644
--- a/src/include/taler_auditor_service.h
+++ b/src/include/taler_auditor_service.h
@@ -49,7 +49,7 @@ struct TALER_AUDITOR_VersionInformation
    * semantics of GNU libtool.  See
    * 
https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
    */
-  char *version;
+  const char *version;
 
 };
 
diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c
index 99d0a4f9..ccb7cc1e 100644
--- a/src/lib/auditor_api_handle.c
+++ b/src/lib/auditor_api_handle.c
@@ -122,6 +122,11 @@ struct TALER_AUDITOR_Handle
    * /version data of the auditor, only valid if
    * @e handshake_complete is past stage #MHS_VERSION.
    */
+  char *version;
+
+  /**
+   * Version information for the callback.
+   */
   struct TALER_AUDITOR_VersionInformation vi;
 
   /**
@@ -177,19 +182,6 @@ free_version_request (struct VersionRequest *vr)
 }
 
 
-/**
- * Free version data object.
- *
- * @param vi data to free (pointer itself excluded)
- */
-static void
-free_version_info (struct TALER_AUDITOR_VersionInformation *vi)
-{
-  GNUNET_free_non_null (vi->version);
-  vi->version = NULL;
-}
-
-
 /**
  * Decode the JSON in @a resp_obj from the /version response and store the data
  * in the @a key_data.
@@ -201,9 +193,10 @@ free_version_info (struct TALER_AUDITOR_VersionInformation 
*vi)
  */
 static enum TALER_ErrorCode
 decode_version_json (const json_t *resp_obj,
-                     struct TALER_AUDITOR_VersionInformation *vi,
+                     struct TALER_AUDITOR_Handle *auditor,
                      enum TALER_AUDITOR_VersionCompatibility *vc)
 {
+  struct TALER_AUDITOR_VersionInformation *vi = &auditor->vi;
   unsigned int age;
   unsigned int revision;
   unsigned int current;
@@ -239,7 +232,8 @@ decode_version_json (const json_t *resp_obj,
     GNUNET_break_op (0);
     return TALER_EC_VERSION_MALFORMED;
   }
-  vi->version = GNUNET_strdup (ver);
+  auditor->version = GNUNET_strdup (ver);
+  vi->version = auditor->version;
   *vc = TALER_AUDITOR_VC_MATCH;
   if (TALER_PROTOCOL_CURRENT < current)
   {
@@ -317,7 +311,7 @@ version_completed_cb (void *cls,
       break;
     }
     hr.ec = decode_version_json (resp_obj,
-                                 &auditor->vi,
+                                 auditor,
                                  &vc);
     if (TALER_EC_NONE != hr.ec)
     {
@@ -345,7 +339,6 @@ version_completed_cb (void *cls,
     auditor->vr = NULL;
     free_version_request (vr);
     auditor->state = MHS_FAILED;
-    free_version_info (&auditor->vi);
     /* notify application that we failed */
     auditor->version_cb (auditor->version_cb_cls,
                          &hr,
@@ -532,7 +525,7 @@ TALER_AUDITOR_disconnect (struct TALER_AUDITOR_Handle 
*auditor)
     free_version_request (auditor->vr);
     auditor->vr = NULL;
   }
-  free_version_info (&auditor->vi);
+  GNUNET_free_non_null (auditor->version);
   if (NULL != auditor->retry_task)
   {
     GNUNET_SCHEDULER_cancel (auditor->retry_task);

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]