From 8419d184411e8cd9457346a7a3d5f9734211a8b2 Mon Sep 17 00:00:00 2001 From: David Fifield Date: Sat, 6 Oct 2012 21:25:25 -0700 Subject: 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. --- src/or/statefile.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/or/statefile.c') 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); } -- cgit v1.2.3-54-g00ecf