Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/rpc use malloc rather than mem_alloc (which is impl...
details: https://anonhg.NetBSD.org/src/rev/dec705af3087
branches: trunk
changeset: 581911:dec705af3087
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Jun 09 22:13:17 2005 +0000
description:
use malloc rather than mem_alloc (which is implemented using calloc)
for receive/send buffers to avoid unnecessarily anonymous memory bloat.
diffstat:
lib/libc/rpc/clnt_dg.c | 7 ++++---
lib/libc/rpc/clnt_raw.c | 6 +++---
lib/libc/rpc/svc_dg.c | 6 +++---
lib/libc/rpc/svc_raw.c | 6 +++---
lib/libc/rpc/xdr_rec.c | 8 ++++----
5 files changed, 17 insertions(+), 16 deletions(-)
diffs (147 lines):
diff -r 29fa88528aba -r dec705af3087 lib/libc/rpc/clnt_dg.c
--- a/lib/libc/rpc/clnt_dg.c Thu Jun 09 22:01:06 2005 +0000
+++ b/lib/libc/rpc/clnt_dg.c Thu Jun 09 22:13:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clnt_dg.c,v 1.14 2004/12/30 05:06:33 christos Exp $ */
+/* $NetBSD: clnt_dg.c,v 1.15 2005/06/09 22:13:17 yamt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
#else
-__RCSID("$NetBSD: clnt_dg.c,v 1.14 2004/12/30 05:06:33 christos Exp $");
+__RCSID("$NetBSD: clnt_dg.c,v 1.15 2005/06/09 22:13:17 yamt Exp $");
#endif
#endif
@@ -241,9 +241,10 @@
*/
sendsz = ((sendsz + 3) / 4) * 4;
recvsz = ((recvsz + 3) / 4) * 4;
- cu = mem_alloc(sizeof (*cu) + sendsz + recvsz);
+ cu = malloc(sizeof (*cu) + sendsz + recvsz);
if (cu == NULL)
goto err1;
+ memset(cu, 0, sizeof(*cu));
(void) memcpy(&cu->cu_raddr, svcaddr->buf, (size_t)svcaddr->len);
cu->cu_rlen = svcaddr->len;
cu->cu_outbuf = &cu->cu_inbuf[recvsz];
diff -r 29fa88528aba -r dec705af3087 lib/libc/rpc/clnt_raw.c
--- a/lib/libc/rpc/clnt_raw.c Thu Jun 09 22:01:06 2005 +0000
+++ b/lib/libc/rpc/clnt_raw.c Thu Jun 09 22:13:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clnt_raw.c,v 1.25 2004/12/30 05:08:37 christos Exp $ */
+/* $NetBSD: clnt_raw.c,v 1.26 2005/06/09 22:13:17 yamt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";
#else
-__RCSID("$NetBSD: clnt_raw.c,v 1.25 2004/12/30 05:08:37 christos Exp $");
+__RCSID("$NetBSD: clnt_raw.c,v 1.26 2005/06/09 22:13:17 yamt Exp $");
#endif
#endif
@@ -116,7 +116,7 @@
}
if (__rpc_rawcombuf == NULL)
__rpc_rawcombuf =
- calloc((size_t)UDPMSGSIZE, sizeof (char));
+ malloc(UDPMSGSIZE);
clp->_raw_buf = __rpc_rawcombuf;
clntraw_private = clp;
}
diff -r 29fa88528aba -r dec705af3087 lib/libc/rpc/svc_dg.c
--- a/lib/libc/rpc/svc_dg.c Thu Jun 09 22:01:06 2005 +0000
+++ b/lib/libc/rpc/svc_dg.c Thu Jun 09 22:13:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svc_dg.c,v 1.10 2003/09/09 03:56:40 itojun Exp $ */
+/* $NetBSD: svc_dg.c,v 1.11 2005/06/09 22:13:17 yamt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -44,7 +44,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: svc_dg.c,v 1.10 2003/09/09 03:56:40 itojun Exp $");
+__RCSID("$NetBSD: svc_dg.c,v 1.11 2005/06/09 22:13:17 yamt Exp $");
#endif
#include "namespace.h"
@@ -138,7 +138,7 @@
if (su == NULL)
goto freedata;
su->su_iosz = ((MAX(sendsize, recvsize) + 3) / 4) * 4;
- if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL)
+ if ((rpc_buffer(xprt) = malloc(su->su_iosz)) == NULL)
goto freedata;
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
XDR_DECODE);
diff -r 29fa88528aba -r dec705af3087 lib/libc/rpc/svc_raw.c
--- a/lib/libc/rpc/svc_raw.c Thu Jun 09 22:01:06 2005 +0000
+++ b/lib/libc/rpc/svc_raw.c Thu Jun 09 22:13:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svc_raw.c,v 1.17 2003/09/09 03:56:40 itojun Exp $ */
+/* $NetBSD: svc_raw.c,v 1.18 2005/06/09 22:13:17 yamt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)svc_raw.c 1.25 89/01/31 Copyr 1984 Sun Micro";
#else
-__RCSID("$NetBSD: svc_raw.c,v 1.17 2003/09/09 03:56:40 itojun Exp $");
+__RCSID("$NetBSD: svc_raw.c,v 1.18 2005/06/09 22:13:17 yamt Exp $");
#endif
#endif
@@ -107,7 +107,7 @@
return (NULL);
}
if (__rpc_rawcombuf == NULL)
- __rpc_rawcombuf = calloc(UDPMSGSIZE, sizeof (char));
+ __rpc_rawcombuf = malloc(UDPMSGSIZE);
srp->raw_buf = __rpc_rawcombuf; /* Share it with the client */
svc_raw_private = srp;
}
diff -r 29fa88528aba -r dec705af3087 lib/libc/rpc/xdr_rec.c
--- a/lib/libc/rpc/xdr_rec.c Thu Jun 09 22:01:06 2005 +0000
+++ b/lib/libc/rpc/xdr_rec.c Thu Jun 09 22:13:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xdr_rec.c,v 1.24 2003/10/03 21:29:16 christos Exp $ */
+/* $NetBSD: xdr_rec.c,v 1.25 2005/06/09 22:13:17 yamt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";
#else
-__RCSID("$NetBSD: xdr_rec.c,v 1.24 2003/10/03 21:29:16 christos Exp $");
+__RCSID("$NetBSD: xdr_rec.c,v 1.25 2005/06/09 22:13:17 yamt Exp $");
#endif
#endif
@@ -194,7 +194,7 @@
}
rstrm->sendsize = sendsize = fix_buf_size(sendsize);
- rstrm->out_base = mem_alloc(rstrm->sendsize);
+ rstrm->out_base = malloc(rstrm->sendsize);
if (rstrm->out_base == NULL) {
warnx("xdrrec_create: out of memory");
mem_free(rstrm, sizeof(RECSTREAM));
@@ -202,7 +202,7 @@
}
rstrm->recvsize = recvsize = fix_buf_size(recvsize);
- rstrm->in_base = mem_alloc(recvsize);
+ rstrm->in_base = malloc(recvsize);
if (rstrm->in_base == NULL) {
warnx("xdrrec_create: out of memory");
mem_free(rstrm->out_base, sendsize);
Home |
Main Index |
Thread Index |
Old Index