Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src calloc() arg mistake. it's (nelem, size). from openbsd
details: https://anonhg.NetBSD.org/src/rev/3129983185fd
branches: trunk
changeset: 535209:3129983185fd
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Aug 12 02:40:20 2002 +0000
description:
calloc() arg mistake. it's (nelem, size). from openbsd
diffstat:
sbin/restore/symtab.c | 6 +++---
usr.bin/file/apprentice.c | 6 +++---
usr.bin/mail/cmd3.c | 8 ++++----
usr.bin/mail/vars.c | 6 +++---
usr.bin/window/wwopen.c | 6 +++---
5 files changed, 16 insertions(+), 16 deletions(-)
diffs (144 lines):
diff -r 93a03b73b882 -r 3129983185fd sbin/restore/symtab.c
--- a/sbin/restore/symtab.c Mon Aug 12 02:39:22 2002 +0000
+++ b/sbin/restore/symtab.c Mon Aug 12 02:40:20 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: symtab.c,v 1.14 2001/06/19 13:42:10 wiz Exp $ */
+/* $NetBSD: symtab.c,v 1.15 2002/08/12 02:40:20 itojun Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)symtab.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: symtab.c,v 1.14 2001/06/19 13:42:10 wiz Exp $");
+__RCSID("$NetBSD: symtab.c,v 1.15 2002/08/12 02:40:20 itojun Exp $");
#endif
#endif /* not lint */
@@ -573,7 +573,7 @@
panic("cannot stat symbol table file %s\n", filename);
}
tblsize = stbuf.st_size - sizeof(struct symtableheader);
- base = calloc(sizeof(char), (unsigned)tblsize);
+ base = calloc((unsigned)tblsize, sizeof(char));
if (base == NULL)
panic("cannot allocate space for symbol table\n");
if (read(fd, base, (int)tblsize) < 0 ||
diff -r 93a03b73b882 -r 3129983185fd usr.bin/file/apprentice.c
--- a/usr.bin/file/apprentice.c Mon Aug 12 02:39:22 2002 +0000
+++ b/usr.bin/file/apprentice.c Mon Aug 12 02:40:20 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apprentice.c,v 1.33 2002/07/10 16:15:52 pooka Exp $ */
+/* $NetBSD: apprentice.c,v 1.34 2002/08/12 02:41:43 itojun Exp $ */
/*
* apprentice - make one pass through /etc/magic, learning its secrets.
@@ -44,7 +44,7 @@
#if 0
FILE_RCSID("@(#)Id: apprentice.c,v 1.49 2002/07/03 19:00:41 christos Exp ")
#else
-__RCSID("$NetBSD: apprentice.c,v 1.33 2002/07/10 16:15:52 pooka Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.34 2002/08/12 02:41:43 itojun Exp $");
#endif
#endif /* lint */
@@ -238,7 +238,7 @@
}
maxmagic = MAXMAGIS;
- *magicp = (struct magic *) calloc(sizeof(struct magic), maxmagic);
+ *magicp = (struct magic *) calloc(maxmagic, sizeof(struct magic));
if (*magicp == NULL) {
(void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
strerror(errno));
diff -r 93a03b73b882 -r 3129983185fd usr.bin/mail/cmd3.c
--- a/usr.bin/mail/cmd3.c Mon Aug 12 02:39:22 2002 +0000
+++ b/usr.bin/mail/cmd3.c Mon Aug 12 02:40:20 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd3.c,v 1.18 2002/03/29 15:07:52 ross Exp $ */
+/* $NetBSD: cmd3.c,v 1.19 2002/08/12 02:42:52 itojun Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95";
#else
-__RCSID("$NetBSD: cmd3.c,v 1.18 2002/03/29 15:07:52 ross Exp $");
+__RCSID("$NetBSD: cmd3.c,v 1.19 2002/08/12 02:42:52 itojun Exp $");
#endif
#endif /* not lint */
@@ -477,7 +477,7 @@
gname = *argv;
h = hash(gname);
if ((gh = findgroup(gname)) == NULL) {
- gh = (struct grouphead *) calloc(sizeof *gh, 1);
+ gh = (struct grouphead *) calloc(1, sizeof *gh);
gh->g_name = vcopy(gname);
gh->g_list = NULL;
gh->g_link = groups[h];
@@ -491,7 +491,7 @@
*/
for (ap = argv+1; *ap != NULL; ap++) {
- gp = (struct group *) calloc(sizeof *gp, 1);
+ gp = (struct group *) calloc(1, sizeof *gp);
gp->ge_name = vcopy(*ap);
gp->ge_link = gh->g_list;
gh->g_list = gp;
diff -r 93a03b73b882 -r 3129983185fd usr.bin/mail/vars.c
--- a/usr.bin/mail/vars.c Mon Aug 12 02:39:22 2002 +0000
+++ b/usr.bin/mail/vars.c Mon Aug 12 02:40:20 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vars.c,v 1.9 2002/03/04 03:16:10 wiz Exp $ */
+/* $NetBSD: vars.c,v 1.10 2002/08/12 02:42:53 itojun Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: vars.c,v 1.9 2002/03/04 03:16:10 wiz Exp $");
+__RCSID("$NetBSD: vars.c,v 1.10 2002/08/12 02:42:53 itojun Exp $");
#endif
#endif /* not lint */
@@ -63,7 +63,7 @@
h = hash(name);
vp = lookup(name);
if (vp == NULL) {
- vp = (struct var *) calloc(sizeof *vp, 1);
+ vp = (struct var *) calloc(1, sizeof *vp);
vp->v_name = vcopy(name);
vp->v_link = variables[h];
variables[h] = vp;
diff -r 93a03b73b882 -r 3129983185fd usr.bin/window/wwopen.c
--- a/usr.bin/window/wwopen.c Mon Aug 12 02:39:22 2002 +0000
+++ b/usr.bin/window/wwopen.c Mon Aug 12 02:40:20 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wwopen.c,v 1.10 2002/06/14 01:07:00 wiz Exp $ */
+/* $NetBSD: wwopen.c,v 1.11 2002/08/12 02:44:18 itojun Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)wwopen.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: wwopen.c,v 1.10 2002/06/14 01:07:00 wiz Exp $");
+__RCSID("$NetBSD: wwopen.c,v 1.11 2002/08/12 02:44:18 itojun Exp $");
#endif
#endif /* not lint */
@@ -60,7 +60,7 @@
char m;
short nvis;
- w = (struct ww *)calloc(sizeof (struct ww), 1);
+ w = (struct ww *)calloc(1, sizeof (struct ww));
if (w == 0) {
wwerrno = WWE_NOMEM;
goto bad;
Home |
Main Index |
Thread Index |
Old Index