Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net Change ns_addr() to allocate 'addr' on stack, r...
details: https://anonhg.NetBSD.org/src/rev/e28d3a45224c
branches: trunk
changeset: 511707:e28d3a45224c
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Jun 25 09:07:08 2001 +0000
description:
Change ns_addr() to allocate 'addr' on stack, rather than using a global -
we don't need a global variable here.
diffstat:
lib/libc/net/ns_addr.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (43 lines):
diff -r 8d8a7a25d2d2 -r e28d3a45224c lib/libc/net/ns_addr.c
--- a/lib/libc/net/ns_addr.c Mon Jun 25 08:47:29 2001 +0000
+++ b/lib/libc/net/ns_addr.c Mon Jun 25 09:07:08 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ns_addr.c,v 1.13 2001/06/17 23:24:22 jdolecek Exp $ */
+/* $NetBSD: ns_addr.c,v 1.14 2001/06/25 09:07:08 jdolecek Exp $ */
/*
* Copyright (c) 1986, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93";
#else
-__RCSID("$NetBSD: ns_addr.c,v 1.13 2001/06/17 23:24:22 jdolecek Exp $");
+__RCSID("$NetBSD: ns_addr.c,v 1.14 2001/06/25 09:07:08 jdolecek Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -52,7 +52,6 @@
#include <stdio.h>
#include <string.h>
-static struct ns_addr addr, zero_addr;
static void Field __P((char *, u_int8_t *, int));
static void cvtbase __P((long, int, int[], int, u_int8_t[], int));
@@ -63,6 +62,7 @@
char separator;
char *hostname, *socketname, *cp;
char buf[50];
+ static struct ns_addr addr;
_DIAGASSERT(name != NULL);
@@ -89,7 +89,7 @@
if (hostname)
*hostname++ = 0;
- addr = zero_addr;
+ memset(&addr, '\0', sizeof(addr));
Field(buf, addr.x_net.c_net, 4);
if (hostname == 0)
return (addr); /* No separator means net only */
Home |
Main Index |
Thread Index |
Old Index