aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-01 12:33:22 -0400
committerNick Mathewson <nickm@torproject.org>2018-11-05 09:22:02 -0500
commit6e7ff8cba0efaf803e3ef5b5aba4123633fe0658 (patch)
tree34d13bcfb483674e0ae52bd3fb60f371c20f0155 /src/app
parent7bb76b24cf755799b7950ef078ac5ccf4d6e3a8a (diff)
downloadtor-6e7ff8cba0efaf803e3ef5b5aba4123633fe0658.tar.gz
tor-6e7ff8cba0efaf803e3ef5b5aba4123633fe0658.zip
Move the code that knows our tor version into a lowest-level lib
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/config.c41
-rw-r--r--src/app/config/config.h2
-rw-r--r--src/app/config/statefile.c1
-rw-r--r--src/app/main/main.c1
4 files changed, 3 insertions, 42 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 6e7e131055..7b49387bcf 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -112,9 +112,9 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/encoding/confline.h"
-#include "lib/log/git_revision.h"
#include "lib/net/resolve.h"
#include "lib/sandbox/sandbox.h"
+#include "lib/version/torversion.h"
#ifdef ENABLE_NSS
#include "lib/crypt_ops/crypto_nss_mgt.h"
@@ -972,42 +972,6 @@ set_options(or_options_t *new_val, char **msg)
return 0;
}
-/** The version of this Tor process, as parsed. */
-static char *the_tor_version = NULL;
-/** A shorter version of this Tor process's version, for export in our router
- * descriptor. (Does not include the git version, if any.) */
-static char *the_short_tor_version = NULL;
-
-/** Return the current Tor version. */
-const char *
-get_version(void)
-{
- if (the_tor_version == NULL) {
- if (strlen(tor_git_revision)) {
- tor_asprintf(&the_tor_version, "%s (git-%s)", get_short_version(),
- tor_git_revision);
- } else {
- the_tor_version = tor_strdup(get_short_version());
- }
- }
- return the_tor_version;
-}
-
-/** Return the current Tor version, without any git tag. */
-const char *
-get_short_version(void)
-{
-
- if (the_short_tor_version == NULL) {
-#ifdef TOR_BUILD_TAG
- tor_asprintf(&the_short_tor_version, "%s (%s)", VERSION, TOR_BUILD_TAG);
-#else
- the_short_tor_version = tor_strdup(VERSION);
-#endif
- }
- return the_short_tor_version;
-}
-
/** Release additional memory allocated in options
*/
STATIC void
@@ -1067,9 +1031,6 @@ config_free_all(void)
tor_free(torrc_defaults_fname);
tor_free(global_dirfrontpagecontents);
- tor_free(the_short_tor_version);
- tor_free(the_tor_version);
-
cleanup_protocol_warning_severity_level();
have_parsed_cmdline = 0;
diff --git a/src/app/config/config.h b/src/app/config/config.h
index a169cfd451..4c497b83a6 100644
--- a/src/app/config/config.h
+++ b/src/app/config/config.h
@@ -41,8 +41,6 @@ const char *escaped_safe_str_client(const char *address);
const char *escaped_safe_str(const char *address);
void init_protocol_warning_severity_level(void);
int get_protocol_warning_severity_level(void);
-const char *get_version(void);
-const char *get_short_version(void);
/** An error from options_trial_assign() or options_init_from_string(). */
typedef enum setopt_err_t {
diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index 8a8b7ced01..4ba7be1519 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -45,6 +45,7 @@
#include "app/config/statefile.h"
#include "lib/encoding/confline.h"
#include "lib/net/resolve.h"
+#include "lib/version/torversion.h"
#include "app/config/or_state_st.h"
diff --git a/src/app/main/main.c b/src/app/main/main.c
index 444d6ea7ec..031f570097 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -84,6 +84,7 @@
#include "lib/encoding/confline.h"
#include "lib/evloop/timers.h"
#include "lib/crypt_ops/crypto_init.h"
+#include "lib/version/torversion.h"
#include <event2/event.h>