diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-07 11:47:47 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-07 11:47:47 +0200 |
commit | aa65247662d5f363e66ba73bc99448a607b486b7 (patch) | |
tree | 9d63b1dd29e805470ce1b1e9930216909dd1c285 /src | |
parent | 9eb741b05bee65dc3d98bc91fb589e9b449ba789 (diff) |
make version field const
Diffstat (limited to 'src')
-rw-r--r-- | src/include/taler_auditor_service.h | 2 | ||||
-rw-r--r-- | 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 fdce76cd2..27959a889 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 99d0a4f9a..ccb7cc1eb 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; /** @@ -178,19 +183,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); |