From: Ian Jackson Date: Sun, 11 May 2014 18:12:03 +0000 (+0100) Subject: comm: Introduce comm_addr_to_string X-Git-Tag: debian/0.3.2_beta1~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=1a448682f9a56b3e33e24fc07767a07e40feaec7;ds=sidebyside comm: Introduce comm_addr_to_string Convenience function for calling addr_to_string. Use it where appropriate. No functional change. Signed-off-by: Ian Jackson --- diff --git a/secnet.h b/secnet.h index 44b180f..647c940 100644 --- a/secnet.h +++ b/secnet.h @@ -344,6 +344,11 @@ struct comm_if { comm_addr_to_string_fn *addr_to_string; }; +static inline const char *comm_addr_to_string(const struct comm_addr *ca) +{ + return ca->comm->addr_to_string(ca->comm->st, ca); +} + /* LOG interface */ #define LOG_MESSAGE_BUFLEN 1023 diff --git a/site.c b/site.c index 1af21ea..1d8c777 100644 --- a/site.c +++ b/site.c @@ -1933,14 +1933,14 @@ static void transport_peers_debug(struct site *st, transport_peers *dst, i++, (argp+=stride?stride:sizeof(*args))) { const struct comm_addr *ca=(void*)argp; slog(st, LOG_PEER_ADDRS, " args: addrs[%d]=%s", - i, ca->comm->addr_to_string(ca->comm->st,ca)); + i, comm_addr_to_string(ca)); } for (i=0; inpeers; i++) { struct timeval diff; timersub(tv_now,&dst->peers[i].last,&diff); const struct comm_addr *ca=&dst->peers[i].addr; slog(st, LOG_PEER_ADDRS, " peers: addrs[%d]=%s T-%ld.%06ld", - i, ca->comm->addr_to_string(ca->comm->st,ca), + i, comm_addr_to_string(ca), (unsigned long)diff.tv_sec, (unsigned long)diff.tv_usec); } } diff --git a/util.c b/util.c index 9a20420..3bfa6bb 100644 --- a/util.c +++ b/util.c @@ -394,7 +394,7 @@ void send_nak(const struct comm_addr *dest, uint32_t our_index, if (logwhy) Message(M_INFO,"%s: %08"PRIx32"<-%08"PRIx32": %08"PRIx32":" " %s; sending NAK\n", - dest->comm->addr_to_string(dest->comm->st,dest), + comm_addr_to_string(dest), our_index, their_index, msgtype, logwhy); dest->comm->sendmsg(dest->comm->st, buf, dest); }