summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/interface.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/networking/interface.c b/networking/interface.c
index b0572d0..24bd13c 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -89,13 +89,9 @@ struct in6_ifreq {
/* Display an Internet socket address. */
static const char* FAST_FUNC INET_sprint(struct sockaddr *sap, int numeric)
{
- static char *buff; /* defaults to NULL */
-
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return "[NONE SET]";
- free(buff);
- buff = INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00);
- return buff;
+ return auto_string(INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00));
}
#ifdef UNUSED_AND_BUGGY
@@ -171,13 +167,9 @@ static const struct aftype inet_aftype = {
/* dirty! struct sockaddr usually doesn't suffer for inet6 addresses, fst. */
static const char* FAST_FUNC INET6_sprint(struct sockaddr *sap, int numeric)
{
- static char *buff;
-
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return "[NONE SET]";
- free(buff);
- buff = INET6_rresolve((struct sockaddr_in6 *) sap, numeric);
- return buff;
+ return auto_string(INET6_rresolve((struct sockaddr_in6 *) sap, numeric));
}
#ifdef UNUSED
@@ -223,13 +215,11 @@ static const struct aftype inet6_aftype = {
/* Display an UNSPEC address. */
static char* FAST_FUNC UNSPEC_print(unsigned char *ptr)
{
- static char *buff;
-
+ char *buff;
char *pos;
unsigned int i;
- if (!buff)
- buff = xmalloc(sizeof(struct sockaddr) * 3 + 1);
+ buff = auto_string(xmalloc(sizeof(struct sockaddr) * 3 + 1));
pos = buff;
for (i = 0; i < sizeof(struct sockaddr); i++) {
/* careful -- not every libc's sprintf returns # bytes written */
@@ -712,14 +702,12 @@ static const struct hwtype loop_hwtype = {
/* Display an Ethernet address in readable format. */
static char* FAST_FUNC ether_print(unsigned char *ptr)
{
- static char *buff;
-
- free(buff);
+ char *buff;
buff = xasprintf("%02X:%02X:%02X:%02X:%02X:%02X",
(ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
(ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
);
- return buff;
+ return auto_string(buff);
}
static const struct hwtype ether_hwtype = {