calloc() arg mistake. it's (nelem, size). from openbsd

This commit is contained in:
itojun 2002-08-12 02:40:20 +00:00
parent 53ca62040c
commit dbf388bc4f
5 changed files with 16 additions and 16 deletions

View File

@ -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 @@ initsymtable(filename)
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 ||

View File

@ -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 @@ apprentice_file(struct magic **magicp, uint32_t *nmagicp, const char *fn,
}
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));

View File

@ -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 @@ group(void *v)
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 @@ group(void *v)
*/
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;

View File

@ -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 @@ assign(char name[], char values[])
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;

View File

@ -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 @@ wwopen(int type, int oflags, int nrow, int ncol, int row, int col, int nline)
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;