From: Ian Jackson Date: Sun, 29 Jun 2014 22:15:58 +0000 (+0100) Subject: ipv6: More buffers in iaddr_to_string X-Git-Tag: base.polypath.v1~22 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=fd324867176088af7465146fe2ed272371782b65;hp=894134bd9376799651bcf153406766cfb31d42ec ipv6: More buffers in iaddr_to_string We are going to have addresses of multiple address families in various places, which will mean more calls to iaddr_to_string for the benefit of the same logging statement. Increase the number of static buffers used by iaddr_to_string from 2 to 8. Signed-off-by: Ian Jackson --- diff --git a/util.c b/util.c index f8ebf25..cbb4e2a 100644 --- a/util.c +++ b/util.c @@ -478,12 +478,16 @@ extern void slilog_part(struct log_if *lf, int priority, const char *message, .. va_end(ap); } +#define IADDR_NBUFS_SHIFT 3 +#define IADDR_NBUFS (1 << IADDR_NBUFS_SHIFT) + const char *iaddr_to_string(const union iaddr *ia) { - static char bufs[2][100]; + static char bufs[IADDR_NBUFS][100]; static int b; - b ^= 1; + b++; + b &= IADDR_NBUFS-1; assert(ia->sa.sa_family == AF_INET);