diff options
author | Chelsea Holland Komlo <me@chelseakomlo.com> | 2017-10-22 00:07:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-10-27 10:02:08 -0400 |
commit | 91bca5c31b9eefe4d07645f690f69914c89a5594 (patch) | |
tree | 919d0f8b657a1e7311395189cfd75ad0ce7d8794 /src/or/main.c | |
parent | 76bbdfbfa9eca46b53d3ec5a44deafce51d2875a (diff) | |
download | tor-91bca5c31b9eefe4d07645f690f69914c89a5594.tar.gz tor-91bca5c31b9eefe4d07645f690f69914c89a5594.zip |
move to allocating c strings from rust
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/or/main.c b/src/or/main.c index 65b0b8f4df..e9f636aa55 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -60,7 +60,6 @@ #include "circuitlist.h" #include "circuituse.h" #include "command.h" -#include "compat_rust.h" #include "compress.h" #include "config.h" #include "confparse.h" @@ -128,6 +127,10 @@ void evdns_shutdown(int); +// helper function defined in Rust to output a log message indicating if tor is +// running with Rust enabled. See src/rust/tor_util +char *rust_welcome_string(void); + /********* PROTOTYPES **********/ static void dumpmemusage(int severity); @@ -3111,14 +3114,13 @@ tor_init(int argc, char *argv[]) "Expect more bugs than usual."); } - { - rust_str_t rust_str = rust_welcome_string(); - const char *s = rust_str_get(rust_str); - if (strlen(s) > 0) { - log_notice(LD_GENERAL, "%s", s); - } - rust_str_free(rust_str); +#ifdef HAVE_RUST + char *rust_str = rust_welcome_string(); + if (rust_str != NULL && strlen(rust_str) > 0) { + log_notice(LD_GENERAL, "%s", rust_str); } + tor_free(rust_str); +#endif if (network_init()<0) { log_err(LD_BUG,"Error initializing network; exiting."); |