diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-11 11:52:51 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-11 11:52:51 -0400 |
commit | e0655708a20069a5f42476a25d62e9d3f8138d8c (patch) | |
tree | 4ee26e5176efe7f61c4fba89bc21886b7508df27 /src/common/address.c | |
parent | 84ddc4b6aad392dd9a735580caf6fb68e3694d42 (diff) | |
parent | 6d2898607bd831944c6c15b6e15200a426149811 (diff) | |
download | tor-e0655708a20069a5f42476a25d62e9d3f8138d8c.tar tor-e0655708a20069a5f42476a25d62e9d3f8138d8c.tar.gz |
Merge remote-tracking branch 'asn/bug4865_take2'
Diffstat (limited to 'src/common/address.c')
-rw-r--r-- | src/common/address.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/common/address.c b/src/common/address.c index 676c48589..7f78d1e4d 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -986,16 +986,21 @@ tor_dup_addr(const tor_addr_t *addr) } } -/** Return a string representing the address <b>addr</b>. This string is - * statically allocated, and must not be freed. Each call to - * <b>fmt_addr</b> invalidates the last result of the function. This - * function is not thread-safe. */ +/** Return a string representing the address <b>addr</b>. This string + * is statically allocated, and must not be freed. Each call to + * <b>fmt_addr_impl</b> invalidates the last result of the function. + * This function is not thread-safe. If <b>decorate</b> is set, add + * brackets to IPv6 addresses. + * + * It's better to use the wrapper macros of this function: + * <b>fmt_addr()</b> and <b>fmt_and_decorate_addr()</b>. + */ const char * -fmt_addr(const tor_addr_t *addr) +fmt_addr_impl(const tor_addr_t *addr, int decorate) { static char buf[TOR_ADDR_BUF_LEN]; if (!addr) return "<null>"; - if (tor_addr_to_str(buf, addr, sizeof(buf), 0)) + if (tor_addr_to_str(buf, addr, sizeof(buf), decorate)) return buf; else return "???"; |