diff options
author | David Fifield <david@bamsoftware.com> | 2012-10-06 21:25:25 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-10-10 22:25:30 -0400 |
commit | 8419d184411e8cd9457346a7a3d5f9734211a8b2 (patch) | |
tree | d97f5e28e33089a948ca958253bdd86aa9b3ab13 /src/or/statefile.c | |
parent | 78e2d8c7a85c8ec2defe5d1873ae19ba9b82b14c (diff) | |
download | tor-8419d184411e8cd9457346a7a3d5f9734211a8b2.tar.gz tor-8419d184411e8cd9457346a7a3d5f9734211a8b2.zip |
Use fmt_addrport where appropriate.
This is mostly a conversion from this pattern:
log("... %s:%d ...", fmt_and_decorate_addr(&addr), port);
to this:
log("... %s ...", fmt_addrport(&addr, port));
The output is the same in all cases.
Diffstat (limited to 'src/or/statefile.c')
-rw-r--r-- | src/or/statefile.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c index dd9d10230f..001c4c3c4b 100644 --- a/src/or/statefile.c +++ b/src/or/statefile.c @@ -553,8 +553,7 @@ save_transport_to_state(const char *transport, if (transport_line) { /* if transport already exists in state... */ const char *prev_bindaddr = /* get its addrport... */ get_transport_bindaddr(transport_line->value, transport); - tor_asprintf(&transport_addrport, "%s:%d", fmt_and_decorate_addr(addr), - (int)port); + transport_addrport = tor_strdup(fmt_addrport(addr, port)); /* if transport in state has the same address as this one, life is good */ if (!strcmp(prev_bindaddr, transport_addrport)) { @@ -566,9 +565,9 @@ save_transport_to_state(const char *transport, "address:port. Let's update the state file with the new " "address:port"); tor_free(transport_line->value); /* free the old line */ - tor_asprintf(&transport_line->value, "%s %s:%d", transport, - fmt_and_decorate_addr(addr), - (int) port); /* replace old addrport line with new line */ + /* replace old addrport line with new line */ + tor_asprintf(&transport_line->value, "%s %s", transport, + fmt_addrport(addr, port)); } } else { /* never seen this one before; save it in state for next time */ log_info(LD_CONFIG, "It's the first time we see this transport. " @@ -585,8 +584,7 @@ save_transport_to_state(const char *transport, /* allocate space for the new line and fill it in */ *next = line = tor_malloc_zero(sizeof(config_line_t)); line->key = tor_strdup("TransportProxy"); - tor_asprintf(&line->value, "%s %s:%d", transport, - fmt_and_decorate_addr(addr), (int) port); + tor_asprintf(&line->value, "%s %s", transport, fmt_addrport(addr, port)); next = &(line->next); } |