chiark
/
gitweb
/
~mdw
/
secnet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Static buffers: Provide new rotating static buffer macros
[secnet]
/
ipaddr.c
diff --git
a/ipaddr.c
b/ipaddr.c
index 1506ae63601f9e8d9c324f9c49d97fc0fef3f7f2..9302925b2039d8f0f6b72717a901c14e09b36498 100644
(file)
--- a/
ipaddr.c
+++ b/
ipaddr.c
@@
-313,17
+313,11
@@
struct subnet_list *ipset_to_subnet_list(struct ipset *is)
return r;
}
return r;
}
-#define IPADDR_NBUFS_SHIFT 4
-#define IPADDR_NBUFS (1 << IPADDR_NBUFS_SHIFT)
#define IPADDR_BUFLEN 20
static char *ipaddr_getbuf(void)
{
#define IPADDR_BUFLEN 20
static char *ipaddr_getbuf(void)
{
- static int b;
- static char bufs[IPADDR_NBUFS][IPADDR_BUFLEN];
-
- b++;
- b &= IPADDR_NBUFS-1;
+ SBUF_DEFINE(16, IPADDR_BUFLEN);
return SBUF;
}
return SBUF;
}