From fd324867176088af7465146fe2ed272371782b65 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 29 Jun 2014 23:15:58 +0100 Subject: [PATCH 1/1] 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 --- util.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); -- 2.30.2